
using System.Web.UI.HtmlControls;
using System;
using System.Configuration;
using System.Drawing;
using System.Data;
using System.Web.UI.WebControls;
using Microsoft.VisualBasic;
using System.Collections;
using System.Web.UI;
using System.Web;


using System.IO;
using System.Text;
//using com.ddsc.database;
using DDSC.OracleADO;
using com.ddsc.common;
using SMAS;
using System.Resources;

//VER 1.1   20080508  EmilyLi   P3108M0374  新增廠商類別 EIC

namespace smasb2b
{
	public class VNDW0010 : BasePage
	{
#region  Web Form 設計工具產生的程式碼
		
		//此為 Web Form 設計工具所需的呼叫。
		[System.Diagnostics.DebuggerStepThrough()]private void InitializeComponent()
		{
			
		}
		protected System.Web.UI.WebControls.Label lblPASSWORD;
		protected ddscControlLibrary.InputBoxCtrl txtPASSWORD;
		protected System.Web.UI.WebControls.Label lblVENDOR_TYPE;
		protected System.Web.UI.WebControls.RadioButtonList rdoVENDOR_TYPE;
		protected System.Web.UI.WebControls.Label lblCONSIGNED_FLAG;
		protected System.Web.UI.WebControls.RadioButtonList rdoCONSIGNED_FLAG;
		protected ddscControlLibrary.SubmitButtonCtrl btnSave;
		protected System.Web.UI.WebControls.Label lblBANK_NAME;
		protected ddscControlLibrary.InputBoxCtrl txtBANK_NAME;
		protected System.Web.UI.WebControls.Label lblBANK_ADDRESS;
		protected ddscControlLibrary.InputBoxCtrl txtBANK_ADDRESS;
		protected System.Web.UI.WebControls.Label lblBANK_CODE_DETAILS;
		protected System.Web.UI.WebControls.Label lblABA_NO;
		protected ddscControlLibrary.InputBoxCtrl txtABA_NO;
		protected System.Web.UI.WebControls.Label lblSORT_CODE;
		protected ddscControlLibrary.InputBoxCtrl txtSORT_CODE;
		protected System.Web.UI.WebControls.Label lblCHIPS;
		protected ddscControlLibrary.InputBoxCtrl txtCHIPS;
		protected System.Web.UI.WebControls.Label lblIACH;
		protected ddscControlLibrary.InputBoxCtrl txtIACH;
		protected ddscControlLibrary.InputBoxCtrl txtFEDWIRD_NO;
		protected System.Web.UI.WebControls.Label lblLOCAL_CLEARING_BANK_CODE;
		protected ddscControlLibrary.InputBoxCtrl txtLOCAL_CLEARING_BANK_CODE;
		protected ddscControlLibrary.InputBoxCtrl txtACH;
		protected ddscControlLibrary.InputBoxCtrl txtOTHERS;
		protected ddscControlLibrary.InputBoxCtrl txtSWIFT_CODE;
		protected System.Web.UI.WebControls.Label lblBENEFICIARYS_AC_NO;
		protected System.Web.UI.WebControls.Label lblBENEFICIARYS_AC_NAME;
		protected System.Web.UI.WebControls.Label lblINTERMEDIARY_BANK_NAME;
		protected ddscControlLibrary.InputBoxCtrl txtINTERMEDIARY_BANK_NAME;
		protected System.Web.UI.WebControls.Label lblINTERMEDIARY_BANK_ADDRESS;
		protected ddscControlLibrary.InputBoxCtrl txtINTERMEDIARY_BANK_ADDRESS;
		protected System.Web.UI.WebControls.Label lblINTERMEDIARY_BANK_SWIFT_CODE;
		protected ddscControlLibrary.InputBoxCtrl txtINTERMEDIARY_BANK_SWIFT_CODE;
		protected System.Web.UI.WebControls.Label lblVENDOR_NO;
		protected ddscControlLibrary.InputBoxCtrl txtVENDOR_NO;
		protected System.Web.UI.WebControls.Label lblVENDOR_NO_ERR;
		protected System.Web.UI.WebControls.Label lblVND_PASSWORD;
		protected ddscControlLibrary.InputBoxCtrl txtVND_PASSWORD;
		protected System.Web.UI.WebControls.Label lblVND_PASSWORD_ERR;
		protected System.Web.UI.WebControls.Label lblVENDOR_CHINESENAME;
		protected ddscControlLibrary.InputBoxCtrl txtVENDOR_CHINESENAME;
		protected System.Web.UI.WebControls.Label lblVENDOR_CHINESENAME_ERR;
		protected System.Web.UI.WebControls.Label lblVENDOR_ENGLISHNAME;
		protected ddscControlLibrary.InputBoxCtrl txtVENDOR_ENGLISHNAME;
		protected System.Web.UI.WebControls.Label lblVENDOR_ENGLISHNAME_ERR;
		protected System.Web.UI.WebControls.Label lblCOUNTRY;
		protected System.Web.UI.WebControls.Label lblCURRENCY_TYPE;
		protected ddscControlLibrary.InputBoxCtrl txtAREA_CODE;
		protected System.Web.UI.WebControls.Label lblADDRESS;
		protected ddscControlLibrary.InputBoxCtrl txtADDRESS;
		protected System.Web.UI.WebControls.Label lblINVOICE_COUNTRY;
		protected System.Web.UI.WebControls.Label lblINVOICE_CITY;
		protected ddscControlLibrary.InputBoxCtrl txtINVOICE_CITY;
		protected System.Web.UI.WebControls.Label lblINVOICE_STATE;
		protected ddscControlLibrary.InputBoxCtrl txtINVOICE_STATE;
		protected System.Web.UI.WebControls.Label lblINVOICE_ADDRESS;
		protected ddscControlLibrary.InputBoxCtrl txtINVOICE_ADDRESS;
		protected System.Web.UI.WebControls.Label lblAGENT;
		protected ddscControlLibrary.InputBoxCtrl txtAGENT;
		protected System.Web.UI.WebControls.Label lblAGENT_ADDRESS;
		protected ddscControlLibrary.InputBoxCtrl txtAGENT_ADDRESS;
		protected System.Web.UI.WebControls.Label lblCLERK;
		protected ddscControlLibrary.InputBoxCtrl txtCLERK;
		protected System.Web.UI.WebControls.Label lblCLERK_ADDRESS;
		protected ddscControlLibrary.InputBoxCtrl txtCLERK_ADDRESS;
		protected System.Web.UI.WebControls.Label lblMAIL_ADDRESS;
		protected ddscControlLibrary.InputBoxCtrl txtMAIL_ADDRESS;
		protected System.Web.UI.WebControls.Label lblTEL1;
		protected ddscControlLibrary.InputBoxCtrl txtTEL1;
		protected System.Web.UI.WebControls.Label lblTEL1_ERR;
		protected System.Web.UI.WebControls.Label lblFAX1;
		protected ddscControlLibrary.InputBoxCtrl txtFAX1;
		protected System.Web.UI.WebControls.Label lblFAX1_ERR;
		protected System.Web.UI.WebControls.Label lblE_MAIL1;
		protected ddscControlLibrary.InputBoxCtrl txtE_MAIL1;
		protected System.Web.UI.WebControls.Label lblE_MAIL1_ERR;
		protected System.Web.UI.WebControls.Label lblTEL2;
		protected ddscControlLibrary.InputBoxCtrl txtTEL2;
		protected System.Web.UI.WebControls.Label lblFAX2;
		protected ddscControlLibrary.InputBoxCtrl txtFAX2;
		protected System.Web.UI.WebControls.Label lblE_MAIL2;
		protected ddscControlLibrary.InputBoxCtrl txtE_MAIL2;
		protected System.Web.UI.WebControls.Label lblE_MAIL2_ERR;
		protected System.Web.UI.WebControls.Label lblAC_N3;
		protected System.Web.UI.WebControls.Label lblAC_N2;
		protected System.Web.UI.WebControls.Label lblFINANCE;
		protected System.Web.UI.WebControls.Label lblVENDORMAINTAIN;
		protected System.Web.UI.WebControls.Label lblTEL2_ERR;
		protected System.Web.UI.WebControls.Label lblFAX2_ERR;
		protected System.Web.UI.WebControls.Label lblFEDWIRD_NO;
		protected System.Web.UI.WebControls.Label lblCURRENCY_1;
		protected System.Web.UI.WebControls.Label lblAC_NO_1;
		protected ddscControlLibrary.InputBoxCtrl txtAC_NO_1;
		protected ddscControlLibrary.InputBoxCtrl txtAC_NO_2;
		protected System.Web.UI.WebControls.Label lblAC_NO_3;
		protected ddscControlLibrary.InputBoxCtrl txtAC_NO_3;
		protected System.Web.UI.WebControls.Label lblBANK_NAME_ERR;
		protected System.Web.UI.WebControls.Label lblABA_NO_ERR;
		protected System.Web.UI.WebControls.Label lblSORT_CODE_ERR;
		protected System.Web.UI.WebControls.Label lblCHIPS_ERR;
		protected System.Web.UI.WebControls.Label lblIACH_ERR;
		protected System.Web.UI.WebControls.Label lblFEDWIRD_NO_ERR;
		protected System.Web.UI.WebControls.Label lblBENEFICIARY_NAME;
		protected ddscControlLibrary.InputBoxCtrl txtBENEFICIARY_NAME;
		protected System.Web.UI.WebControls.Label lblBANK_ADDRESS_ERR;
		protected System.Web.UI.WebControls.Label lblLOCAL_CLEARING_BANK_CODE_ERR;
		protected System.Web.UI.WebControls.Label lblACH_ERR;
		protected System.Web.UI.WebControls.Label lblSWIFT_CODE;
		protected System.Web.UI.WebControls.DropDownList drpCURRENCY_TYPE;
		protected System.Web.UI.HtmlControls.HtmlInputButton btnCHANGE_PASSWORD;
		protected System.Web.UI.HtmlControls.HtmlGenericControl DIV1;
		protected System.Web.UI.HtmlControls.HtmlGenericControl DIV2;
		protected System.Web.UI.WebControls.Label lblVENDOR_KIND;
		protected System.Web.UI.WebControls.Label lblAREA_CODE;
		protected System.Web.UI.WebControls.Label lblCURRENCY_2;
		protected System.Web.UI.WebControls.Label lblAC_NO_2;
		protected System.Web.UI.WebControls.Label lblCURRENCY_3;
		protected System.Web.UI.WebControls.Label lblOTHERS;
		protected System.Web.UI.WebControls.Label lblACH;
		protected System.Web.UI.WebControls.Label lblMSG010;
		protected System.Web.UI.HtmlControls.HtmlImage IMG1;
		protected System.Web.UI.WebControls.DropDownList drpVENDOR_KIND;
		protected System.Web.UI.WebControls.DropDownList drpCOUNTRY1;
		protected System.Web.UI.WebControls.DropDownList drpCOUNTRY2;
		protected System.Web.UI.WebControls.DropDownList drpCOUNTRY;
		protected System.Web.UI.WebControls.DropDownList drpINVOICE_COUNTRY;
		protected System.Web.UI.WebControls.Button Button1;
		protected ddscControlLibrary.ClientButtonCtrl btnSEARCH;
		protected System.Web.UI.WebControls.Label lblSWIFT_CODE_ERR;
		protected System.Web.UI.WebControls.Label lblCURRENCY_ERR;
		protected System.Web.UI.WebControls.Label lblAC_NO_ERR;
		protected System.Web.UI.WebControls.DropDownList drpCURRENCY_1;
		protected System.Web.UI.WebControls.DropDownList drpCURRENCY_2;
		protected System.Web.UI.WebControls.DropDownList drpCURRENCY_3;
		protected System.Web.UI.HtmlControls.HtmlGenericControl DIV3;
		protected System.Web.UI.HtmlControls.HtmlInputHidden hidTEST;
		protected System.Web.UI.WebControls.Label lblVENDOR_KIND_ERR;
		protected System.Web.UI.HtmlControls.HtmlInputButton BTNAS_ABOVE1;
		protected System.Web.UI.HtmlControls.HtmlInputButton BTNAS_ABOVE2;
		protected System.Web.UI.HtmlControls.HtmlInputButton BTNAS_ABOVE3;
		protected System.Web.UI.WebControls.Label lblPROFILE_PRODUCT;
		protected ddscControlLibrary.InputBoxCtrl txtPROFILE_PRODUCT;
		protected System.Web.UI.WebControls.Label lblPROFILE_PRODUCT_ERR;
		protected System.Web.UI.WebControls.Label lblMSG058;
		protected System.Web.UI.WebControls.Label lblE_MAIL3;
		protected ddscControlLibrary.InputBoxCtrl txtE_MAIL3;
		protected System.Web.UI.WebControls.Label lblE_MAIL3_ERR;
		protected System.Web.UI.WebControls.Label lblWEBSITE;
		protected ddscControlLibrary.InputBoxCtrl txtWEBSITE;
		protected System.Web.UI.WebControls.Label lblAUTHENTICATION;
		protected ddscControlLibrary.InputBoxCtrl txtAUTHENTICATION;
		protected System.Web.UI.WebControls.Label lblCOOPERATION;
		protected ddscControlLibrary.InputBoxCtrl txtCOOPERATION;
		protected System.Web.UI.WebControls.Label lblCRT_DATE;
		protected ddscControlLibrary.InputBoxCtrl txtCRT_DATE;
		protected System.Web.UI.WebControls.Label lblUPD_DATE;
		protected ddscControlLibrary.InputBoxCtrl txtUPD_DATE;
		protected System.Web.UI.WebControls.Label lblCLASS_DESCRIPTION;
		
		//注意: 下列預留位置宣告是 Web Form 設計工具需要的項目。
		//請勿刪除或移動它。
		private System.Object designerPlaceholderDeclaration;
		
		private void Page_Init(System.Object sender, System.EventArgs e)
		{
			//CODEGEN: 此為 Web Form 設計工具所需的方法呼叫
			//請勿使用程式碼編輯器進行修改。
			InitializeComponent();
		}
		
#endregion
		// Dim BasePage As BasePage = New BasePage
		
#region 呼叫後端method
		
		private bool getDELIVERY_TERM()
		{
			bool result = false;
			int i;
			try
			{
				string[] DELIVERY_TERM_EN = new string[8];
				DELIVERY_TERM_EN[0] = "FOB_Seaport";
				DELIVERY_TERM_EN[1] = "CIF_keeling";
				DELIVERY_TERM_EN[2] = "Ex_Work";
				DELIVERY_TERM_EN[3] = "CIF_長榮航空保稅倉庫";
				DELIVERY_TERM_EN[4] = "長榮航空保稅大樓倉庫";
				DELIVERY_TERM_EN[5] = "長榮航空南崁運航大樓倉庫";
				DELIVERY_TERM_EN[6] = "FOB_Airport";
				DELIVERY_TERM_EN[7] = "CIF_CKS_Airport";
				string[] DELIVERY_TERM_TW = new string[8];
				DELIVERY_TERM_TW[0] = "FOB_Seaport";
				DELIVERY_TERM_TW[1] = "CIF_keeling";
				DELIVERY_TERM_TW[2] = "Ex_Work";
				DELIVERY_TERM_TW[3] = "CIF_長榮航空保稅倉庫";
				DELIVERY_TERM_TW[4] = "長榮航空保稅大樓倉庫";
				DELIVERY_TERM_TW[5] = "長榮航空南崁運航大樓倉庫";
				DELIVERY_TERM_TW[6] = "FOB_Airport";
				DELIVERY_TERM_TW[7] = "CIF_CKS_Airport";
				// 將資料寫入下拉式選單
				
				//If Session("langauage") = "zh-tw" Then
				//    drpDELIVERY_TERM.Items.Insert(0, New ListItem("Select", ""))
				//    For i = 0 To 7
				//        drpDELIVERY_TERM.Items.Insert(i + 1, New ListItem(DELIVERY_TERM_TW(i), DELIVERY_TERM_TW(i)))
				//    Next
				//Else
				//    drpDELIVERY_TERM.Items.Insert(0, New ListItem("Select", ""))
				//    For i = 0 To 7
				//        drpDELIVERY_TERM.Items.Insert(i + 1, New ListItem(DELIVERY_TERM_EN(i), DELIVERY_TERM_EN(i)))
				//    Next
				//End If
				
				
			}
			catch (Exception ex)
			{
				showException(ex.Message);
			}
			finally
			{
			}
			return result;
		}
		
		private bool getCOUNTRY()
		{
			bool result = false;
			int i = 0;
			try
			{
				// 將資料寫入下拉式選單
				string[] COUNTRY_EN = new string[222];
				COUNTRY_EN[0] = "Afghanistan";
				COUNTRY_EN[1] = "Albania";
				COUNTRY_EN[2] = "Algeria";
				COUNTRY_EN[3] = "Am_Samoa";
				COUNTRY_EN[4] = "Andorra";
				COUNTRY_EN[5] = "Angola";
				COUNTRY_EN[6] = "Anguilla";
				COUNTRY_EN[7] = "Antigua";
				COUNTRY_EN[8] = "Antilles";
				COUNTRY_EN[9] = "ArgCOUNTRY_ENtina";
				COUNTRY_EN[10] = "ArmCOUNTRY_ENia";
				COUNTRY_EN[11] = "Aruba";
				COUNTRY_EN[12] = "AscCOUNTRY_ENsion";
				COUNTRY_EN[13] = "Australia";
				COUNTRY_EN[14] = "Austria";
				COUNTRY_EN[15] = "Azerbaidjan";
				COUNTRY_EN[16] = "Bahamas";
				COUNTRY_EN[17] = "Bahrain";
				COUNTRY_EN[18] = "Bangladesh";
				COUNTRY_EN[19] = "Barbados";
				COUNTRY_EN[20] = "Belarus";
				COUNTRY_EN[21] = "Belgium";
				COUNTRY_EN[22] = "Belize";
				COUNTRY_EN[23] = "Belorussia";
				COUNTRY_EN[24] = "BCOUNTRY_ENin";
				COUNTRY_EN[25] = "Bermuda";
				COUNTRY_EN[26] = "Bhutan";
				COUNTRY_EN[27] = "Bolivia";
				COUNTRY_EN[28] = "Bosnia";
				COUNTRY_EN[29] = "Botswana";
				COUNTRY_EN[30] = "Brazil";
				COUNTRY_EN[31] = "British_Virgin";
				COUNTRY_EN[32] = "Brunei";
				COUNTRY_EN[33] = "Bulgaria";
				COUNTRY_EN[34] = "Burkina_Faso";
				COUNTRY_EN[35] = "Burundi";
				COUNTRY_EN[36] = "Cambodia";
				COUNTRY_EN[37] = "Cameroon";
				COUNTRY_EN[38] = "Canada";
				COUNTRY_EN[39] = "Cape_Verde";
				COUNTRY_EN[40] = "Cayman_Islands";
				COUNTRY_EN[41] = "CCOUNTRY_ENtral_Africa";
				COUNTRY_EN[42] = "Chad";
				COUNTRY_EN[43] = "Chile";
				COUNTRY_EN[44] = "China";
				COUNTRY_EN[45] = "Christmas Island";
				COUNTRY_EN[46] = "Colombia";
				COUNTRY_EN[47] = "Comoros";
				COUNTRY_EN[48] = "Congo";
				COUNTRY_EN[49] = "Cook";
				COUNTRY_EN[50] = "Costa_Rica";
				COUNTRY_EN[51] = "Croatia";
				COUNTRY_EN[52] = "Cuba";
				COUNTRY_EN[53] = "Cyprus";
				COUNTRY_EN[54] = "Czech";
				COUNTRY_EN[55] = "DCOUNTRY_ENmark";
				COUNTRY_EN[56] = "Djibouti";
				COUNTRY_EN[57] = "Dominica";
				COUNTRY_EN[58] = "Dominican";
				COUNTRY_EN[59] = "Ecuador";
				COUNTRY_EN[60] = "Egypt";
				COUNTRY_EN[61] = "El_Salvador";
				COUNTRY_EN[62] = "Equatorial";
				COUNTRY_EN[63] = "Eritrea";
				COUNTRY_EN[64] = "Estonia";
				COUNTRY_EN[65] = "Ethiopia";
				COUNTRY_EN[66] = "Falkland";
				COUNTRY_EN[67] = "Fiji";
				COUNTRY_EN[68] = "Finland";
				COUNTRY_EN[69] = "France";
				COUNTRY_EN[70] = "Gabon";
				COUNTRY_EN[71] = "Gambia";
				COUNTRY_EN[72] = "Georgia";
				COUNTRY_EN[73] = "Germany";
				COUNTRY_EN[74] = "Ghana";
				COUNTRY_EN[75] = "Gibraltar";
				COUNTRY_EN[76] = "Greece";
				COUNTRY_EN[77] = "GreCOUNTRY_ENland";
				COUNTRY_EN[78] = "GrCOUNTRY_ENada";
				COUNTRY_EN[79] = "Guadeloupe";
				COUNTRY_EN[80] = "Guam";
				COUNTRY_EN[81] = "Guatemala";
				COUNTRY_EN[82] = "Guiana";
				COUNTRY_EN[83] = "Guinea";
				COUNTRY_EN[84] = "Guinea_Bissau";
				COUNTRY_EN[85] = "Guyana";
				COUNTRY_EN[86] = "Haiti";
				COUNTRY_EN[87] = "Honduras";
				COUNTRY_EN[88] = "Hong Kong";
				COUNTRY_EN[89] = "Hungary";
				COUNTRY_EN[90] = "Iceland";
				COUNTRY_EN[91] = "India";
				COUNTRY_EN[92] = "Indonesia";
				COUNTRY_EN[93] = "Iran";
				COUNTRY_EN[94] = "Iraq";
				COUNTRY_EN[95] = "Ireland";
				COUNTRY_EN[96] = "Israel";
				COUNTRY_EN[97] = "Italy";
				COUNTRY_EN[98] = "Ivory_Coast";
				COUNTRY_EN[99] = "Jamaica";
				COUNTRY_EN[100] = "Japan";
				COUNTRY_EN[101] = "Jordan";
				COUNTRY_EN[102] = "Kazakhstan";
				COUNTRY_EN[103] = "kCOUNTRY_ENya";
				COUNTRY_EN[104] = "Kiribati";
				COUNTRY_EN[105] = "Korea_South";
				COUNTRY_EN[106] = "Korea_North";
				COUNTRY_EN[107] = "Kuwait";
				COUNTRY_EN[108] = "Latvia";
				COUNTRY_EN[109] = "Laos";
				COUNTRY_EN[110] = "Lebanon";
				COUNTRY_EN[111] = "Lesotho";
				COUNTRY_EN[112] = "Liberia";
				COUNTRY_EN[113] = "Libya";
				COUNTRY_EN[114] = "LiechtCOUNTRY_ENstein";
				COUNTRY_EN[115] = "Lithuania";
				COUNTRY_EN[116] = "Luxembourg";
				COUNTRY_EN[117] = "Macao";
				COUNTRY_EN[118] = "Macedonia";
				COUNTRY_EN[119] = "Madagascar";
				COUNTRY_EN[120] = "Malawi";
				COUNTRY_EN[121] = "Malaysia";
				COUNTRY_EN[122] = "Maldives";
				COUNTRY_EN[123] = "Mali";
				COUNTRY_EN[124] = "Malta";
				COUNTRY_EN[125] = "Marshall";
				COUNTRY_EN[126] = "Martinique";
				COUNTRY_EN[127] = "Mauritania";
				COUNTRY_EN[128] = "Mauritius";
				COUNTRY_EN[129] = "Mexico";
				COUNTRY_EN[130] = "Micronesia";
				COUNTRY_EN[131] = "Moldova";
				COUNTRY_EN[132] = "Monaco";
				COUNTRY_EN[133] = "Mongolia";
				COUNTRY_EN[134] = "Montserrat";
				COUNTRY_EN[135] = "Morocco";
				COUNTRY_EN[136] = "Mozambique";
				COUNTRY_EN[137] = "Myanmar";
				COUNTRY_EN[138] = "Namibia";
				COUNTRY_EN[139] = "Nauru";
				COUNTRY_EN[140] = "Nepal";
				COUNTRY_EN[141] = "Netherlands";
				COUNTRY_EN[142] = "Ne_Antilles";
				COUNTRY_EN[143] = "New_Caledonia";
				COUNTRY_EN[144] = "New_Zealand";
				COUNTRY_EN[145] = "Nicaragua";
				COUNTRY_EN[146] = "Niger";
				COUNTRY_EN[147] = "Nigeria";
				COUNTRY_EN[148] = "Niue";
				COUNTRY_EN[149] = "Norfolk";
				COUNTRY_EN[150] = "Norway";
				COUNTRY_EN[151] = "Oman";
				COUNTRY_EN[152] = "Pakistan";
				COUNTRY_EN[153] = "Palau";
				COUNTRY_EN[154] = "Panama";
				COUNTRY_EN[155] = "Papua";
				COUNTRY_EN[156] = "Paraguay";
				COUNTRY_EN[157] = "Peru";
				COUNTRY_EN[158] = "Philippines";
				COUNTRY_EN[159] = "Poland";
				COUNTRY_EN[160] = "Polynesia";
				COUNTRY_EN[161] = "Portugal";
				COUNTRY_EN[162] = "Puerto_Rico";
				COUNTRY_EN[163] = "Qatar";
				COUNTRY_EN[164] = "Reunion";
				COUNTRY_EN[165] = "Romania";
				COUNTRY_EN[166] = "Russia";
				COUNTRY_EN[167] = "Rwanda";
				COUNTRY_EN[168] = "Saipan";
				COUNTRY_EN[169] = "San_Marino";
				COUNTRY_EN[170] = "Sao_Tome";
				COUNTRY_EN[171] = "Saudi_Arabia";
				COUNTRY_EN[172] = "SCOUNTRY_ENegal";
				COUNTRY_EN[173] = "Seychelles";
				COUNTRY_EN[174] = "Sierra_Leone";
				COUNTRY_EN[175] = "Singapore";
				COUNTRY_EN[176] = "Slovak";
				COUNTRY_EN[177] = "SlovCOUNTRY_ENia";
				COUNTRY_EN[178] = "Solomon";
				COUNTRY_EN[179] = "Somalia";
				COUNTRY_EN[180] = "South_Africa";
				COUNTRY_EN[181] = "Spain";
				COUNTRY_EN[182] = "Sri_Lanka";
				COUNTRY_EN[183] = "St_Christopher";
				COUNTRY_EN[184] = "St_HelCOUNTRY_ENa";
				COUNTRY_EN[185] = "St_Lucia";
				COUNTRY_EN[186] = "St_Pierre&Miquelon";
				COUNTRY_EN[187] = "St_VincCOUNTRY_ENt";
				COUNTRY_EN[188] = "Sudan";
				COUNTRY_EN[189] = "Suriname";
				COUNTRY_EN[190] = "Swaziland ";
				COUNTRY_EN[191] = "SwedCOUNTRY_EN";
				COUNTRY_EN[192] = "Switzerland";
				COUNTRY_EN[193] = "Syria";
				COUNTRY_EN[194] = "Taiwan";
				COUNTRY_EN[195] = "Tanzania";
				COUNTRY_EN[196] = "Thailand";
				COUNTRY_EN[197] = "Togo";
				COUNTRY_EN[198] = "Tonga";
				COUNTRY_EN[199] = "Trinidad_Tobago";
				COUNTRY_EN[200] = "Tunisia";
				COUNTRY_EN[201] = "Turkey";
				COUNTRY_EN[202] = "TurkmCOUNTRY_ENistan";
				COUNTRY_EN[203] = "Turks_Caicos";
				COUNTRY_EN[204] = "Tuvalu";
				COUNTRY_EN[205] = "United_Arab ";
				COUNTRY_EN[206] = "U_K";
				COUNTRY_EN[207] = "U_S_A";
				COUNTRY_EN[208] = "Uganda";
				COUNTRY_EN[209] = "Ukraine";
				COUNTRY_EN[210] = "Uruguay";
				COUNTRY_EN[211] = "Uzbekistan";
				COUNTRY_EN[212] = "Vanuatu";
				COUNTRY_EN[213] = "Vatican";
				COUNTRY_EN[214] = "VCOUNTRY_ENezuela";
				COUNTRY_EN[215] = "Viet_Nam";
				COUNTRY_EN[216] = "Western_Sahara";
				COUNTRY_EN[217] = "Western_Samoa";
				COUNTRY_EN[218] = "YemCOUNTRY_EN";
				COUNTRY_EN[219] = "Yugoslavia";
				COUNTRY_EN[220] = "Zambia";
				COUNTRY_EN[221] = "Zimbabwe";
				string[] COUNTRY_TW = new string[222];
				COUNTRY_TW[0] = "阿富汗";
				COUNTRY_TW[1] = "阿爾巴尼亞";
				COUNTRY_TW[2] = "阿爾及利亞";
				COUNTRY_TW[3] = "美屬薩摩亞";
				COUNTRY_TW[4] = "安道爾";
				COUNTRY_TW[5] = "安哥拉";
				COUNTRY_TW[6] = "安圭拉島";
				COUNTRY_TW[7] = "安地卡";
				COUNTRY_TW[8] = "荷屬安地列斯群島";
				COUNTRY_TW[9] = "阿根廷";
				COUNTRY_TW[10] = "亞美尼亞";
				COUNTRY_TW[11] = "阿魯巴島";
				COUNTRY_TW[12] = "亞森欣島";
				COUNTRY_TW[13] = "澳大利亞";
				COUNTRY_TW[14] = "奧地利";
				COUNTRY_TW[15] = "亞塞拜然";
				COUNTRY_TW[16] = "巴哈馬群島";
				COUNTRY_TW[17] = "巴林";
				COUNTRY_TW[18] = "孟加拉";
				COUNTRY_TW[19] = "巴貝多";
				COUNTRY_TW[20] = "柏勞斯";
				COUNTRY_TW[21] = "比利時";
				COUNTRY_TW[22] = "貝里斯";
				COUNTRY_TW[23] = "白俄羅斯";
				COUNTRY_TW[24] = "貝南";
				COUNTRY_TW[25] = "百慕達群島";
				COUNTRY_TW[26] = "不丹";
				COUNTRY_TW[27] = "玻利維亞";
				COUNTRY_TW[28] = "波士尼亞";
				COUNTRY_TW[29] = "波札那";
				COUNTRY_TW[30] = "巴西";
				COUNTRY_TW[31] = "英屬處女島";
				COUNTRY_TW[32] = "汶萊";
				COUNTRY_TW[33] = "保加利亞";
				COUNTRY_TW[34] = "布吉納法索";
				COUNTRY_TW[35] = "蒲隆地";
				COUNTRY_TW[36] = "柬埔寨";
				COUNTRY_TW[37] = "喀麥隆";
				COUNTRY_TW[38] = "加拿大";
				COUNTRY_TW[39] = "維德角";
				COUNTRY_TW[40] = "開曼群島";
				COUNTRY_TW[41] = "中非共和國";
				COUNTRY_TW[42] = "查德";
				COUNTRY_TW[43] = "智利";
				COUNTRY_TW[44] = "中國";
				COUNTRY_TW[45] = "聖誕島嶼";
				COUNTRY_TW[46] = "哥倫比亞";
				COUNTRY_TW[47] = "葛摩伊斯蘭聯邦共和國";
				COUNTRY_TW[48] = "剛果民主共和國";
				COUNTRY_TW[49] = "科克群島";
				COUNTRY_TW[50] = "哥斯大黎加";
				COUNTRY_TW[51] = "克羅埃西亞";
				COUNTRY_TW[52] = "古巴";
				COUNTRY_TW[53] = "賽普勒斯";
				COUNTRY_TW[54] = "捷克";
				COUNTRY_TW[55] = "丹麥";
				COUNTRY_TW[56] = "吉布地";
				COUNTRY_TW[57] = "多米尼克";
				COUNTRY_TW[58] = "多明尼加";
				COUNTRY_TW[59] = "厄瓜多";
				COUNTRY_TW[60] = "埃及";
				COUNTRY_TW[61] = "薩爾瓦多";
				COUNTRY_TW[62] = "赤道幾內亞";
				COUNTRY_TW[63] = "厄立特里亞";
				COUNTRY_TW[64] = "愛沙尼亞";
				COUNTRY_TW[65] = "衣索比亞";
				COUNTRY_TW[66] = "福克蘭群島";
				COUNTRY_TW[67] = "裴濟";
				COUNTRY_TW[68] = "芬蘭";
				COUNTRY_TW[69] = "法國";
				COUNTRY_TW[70] = "加彭";
				COUNTRY_TW[71] = "甘比亞";
				COUNTRY_TW[72] = "喬治亞洲";
				COUNTRY_TW[73] = "德國";
				COUNTRY_TW[74] = "迦納";
				COUNTRY_TW[75] = "直布羅陀海峽";
				COUNTRY_TW[76] = "希臘";
				COUNTRY_TW[77] = "格陵蘭";
				COUNTRY_TW[78] = "格瑞那達";
				COUNTRY_TW[79] = "瓜達康納爾島";
				COUNTRY_TW[80] = "關島";
				COUNTRY_TW[81] = "瓜地馬拉";
				COUNTRY_TW[82] = "法屬圭亞那";
				COUNTRY_TW[83] = "幾內亞";
				COUNTRY_TW[84] = "幾內亞比索";
				COUNTRY_TW[85] = "蓋亞那";
				COUNTRY_TW[86] = "海地巴哈馬群島";
				COUNTRY_TW[87] = "宏都拉斯";
				COUNTRY_TW[88] = "香港";
				COUNTRY_TW[89] = "匈牙利";
				COUNTRY_TW[90] = "冰島";
				COUNTRY_TW[91] = "印度";
				COUNTRY_TW[92] = "印尼";
				COUNTRY_TW[93] = "伊朗";
				COUNTRY_TW[94] = "伊拉克";
				COUNTRY_TW[95] = "愛爾蘭";
				COUNTRY_TW[96] = "以色列";
				COUNTRY_TW[97] = "義大利";
				COUNTRY_TW[98] = "象牙海岸";
				COUNTRY_TW[99] = "牙買加";
				COUNTRY_TW[100] = "日本";
				COUNTRY_TW[101] = "約旦";
				COUNTRY_TW[102] = "哈薩克";
				COUNTRY_TW[103] = "肯亞";
				COUNTRY_TW[104] = "吉里巴斯";
				COUNTRY_TW[105] = "南韓";
				COUNTRY_TW[106] = "北韓";
				COUNTRY_TW[107] = "科威特";
				COUNTRY_TW[108] = "拉脫維亞";
				COUNTRY_TW[109] = "寮國";
				COUNTRY_TW[110] = "黎巴嫩";
				COUNTRY_TW[111] = "賴索托";
				COUNTRY_TW[112] = "賴比瑞亞";
				COUNTRY_TW[113] = "利比亞";
				COUNTRY_TW[114] = "列支敦斯登";
				COUNTRY_TW[115] = "立陶宛";
				COUNTRY_TW[116] = "盧森堡";
				COUNTRY_TW[117] = "澳門";
				COUNTRY_TW[118] = "馬其頓";
				COUNTRY_TW[119] = "馬達加斯加";
				COUNTRY_TW[120] = "馬拉威";
				COUNTRY_TW[121] = "馬來西亞";
				COUNTRY_TW[122] = "馬爾地夫";
				COUNTRY_TW[123] = "馬利";
				COUNTRY_TW[124] = "馬爾他";
				COUNTRY_TW[125] = "馬紹爾群島";
				COUNTRY_TW[126] = "聖馬丁節";
				COUNTRY_TW[127] = "茅利塔尼亞";
				COUNTRY_TW[128] = "模里西斯";
				COUNTRY_TW[129] = "墨西哥";
				COUNTRY_TW[130] = "密克羅尼西亞";
				COUNTRY_TW[131] = "摩爾多瓦";
				COUNTRY_TW[132] = "摩納哥";
				COUNTRY_TW[133] = "蒙古";
				COUNTRY_TW[134] = "蒙特色納島";
				COUNTRY_TW[135] = "摩洛哥";
				COUNTRY_TW[136] = "莫三比克";
				COUNTRY_TW[137] = "緬甸";
				COUNTRY_TW[138] = "納米比亞";
				COUNTRY_TW[139] = "諾魯";
				COUNTRY_TW[140] = "尼泊爾";
				COUNTRY_TW[141] = "荷蘭";
				COUNTRY_TW[142] = "荷屬西印度群島";
				COUNTRY_TW[143] = "新蘇格蘭";
				COUNTRY_TW[144] = "紐西蘭";
				COUNTRY_TW[145] = "尼加拉瓜";
				COUNTRY_TW[146] = "尼日";
				COUNTRY_TW[147] = "奈及利亞";
				COUNTRY_TW[148] = "尼烏亞島";
				COUNTRY_TW[149] = "諾福克島嶼";
				COUNTRY_TW[150] = "挪威";
				COUNTRY_TW[151] = "阿曼";
				COUNTRY_TW[152] = "巴基斯坦";
				COUNTRY_TW[153] = "帛琉";
				COUNTRY_TW[154] = "巴拿馬";
				COUNTRY_TW[155] = "巴布亞紐幾內亞";
				COUNTRY_TW[156] = "巴拉圭";
				COUNTRY_TW[157] = "秘魯";
				COUNTRY_TW[158] = "菲律賓";
				COUNTRY_TW[159] = "波蘭";
				COUNTRY_TW[160] = "法屬波里尼西亞";
				COUNTRY_TW[161] = "葡萄牙";
				COUNTRY_TW[162] = "波多黎各";
				COUNTRY_TW[163] = "卡達";
				COUNTRY_TW[164] = "留尼旺";
				COUNTRY_TW[165] = "羅馬尼亞";
				COUNTRY_TW[166] = "俄羅斯";
				COUNTRY_TW[167] = "盧安達";
				COUNTRY_TW[168] = "塞班";
				COUNTRY_TW[169] = "聖馬利諾";
				COUNTRY_TW[170] = "聖多美  ";
				COUNTRY_TW[171] = "沙烏地阿拉伯";
				COUNTRY_TW[172] = "塞內加爾";
				COUNTRY_TW[173] = "賽席爾群島";
				COUNTRY_TW[174] = "獅子山";
				COUNTRY_TW[175] = "新加坡";
				COUNTRY_TW[176] = "斯洛伐克";
				COUNTRY_TW[177] = "斯洛法尼亞";
				COUNTRY_TW[178] = "索羅門";
				COUNTRY_TW[179] = "索馬利亞";
				COUNTRY_TW[180] = "南非";
				COUNTRY_TW[181] = "西班牙";
				COUNTRY_TW[182] = "斯里蘭卡";
				COUNTRY_TW[183] = "聖克里斯多福及尼維斯";
				COUNTRY_TW[184] = "聖赫勒拿島";
				COUNTRY_TW[185] = "聖露西亞";
				COUNTRY_TW[186] = "聖匹島及密啟倫群群島";
				COUNTRY_TW[187] = "聖文森及格瑞那丁";
				COUNTRY_TW[188] = "蘇丹";
				COUNTRY_TW[189] = "蘇利南";
				COUNTRY_TW[190] = "史瓦濟蘭 ";
				COUNTRY_TW[191] = "瑞典";
				COUNTRY_TW[192] = "瑞士";
				COUNTRY_TW[193] = "敘利亞";
				COUNTRY_TW[194] = "臺灣";
				COUNTRY_TW[195] = "坦尚尼亞";
				COUNTRY_TW[196] = "泰國";
				COUNTRY_TW[197] = "土哥";
				COUNTRY_TW[198] = "東加";
				COUNTRY_TW[199] = "千里達及托巴哥";
				COUNTRY_TW[200] = "突尼西亞";
				COUNTRY_TW[201] = "土耳其";
				COUNTRY_TW[202] = "土庫曼";
				COUNTRY_TW[203] = "土克斯及開科斯群島";
				COUNTRY_TW[204] = "吐瓦魯";
				COUNTRY_TW[205] = "阿拉伯聯合大公國";
				COUNTRY_TW[206] = "英國";
				COUNTRY_TW[207] = "美國";
				COUNTRY_TW[208] = "烏干達";
				COUNTRY_TW[209] = "烏克蘭";
				COUNTRY_TW[210] = "烏拉圭";
				COUNTRY_TW[211] = "烏茲別克斯坦";
				COUNTRY_TW[212] = "萬納杜";
				COUNTRY_TW[213] = "梵蒂岡";
				COUNTRY_TW[214] = "委內瑞拉";
				COUNTRY_TW[215] = "越南";
				COUNTRY_TW[216] = "西撒哈拉沙漠";
				COUNTRY_TW[217] = "西薩摩亞";
				COUNTRY_TW[218] = "葉門";
				COUNTRY_TW[219] = "南斯拉夫";
				COUNTRY_TW[220] = "尚比亞";
				COUNTRY_TW[221] = "辛巴威";
				drpCOUNTRY.Items.Insert(0, new ListItem("Select", ""));
				drpINVOICE_COUNTRY.Items.Insert(0, new ListItem("Select", ""));
				if (Session["langauage"] == "zh-tw")
				{
					for (i = 0; i <= 221; i++)
					{
						drpCOUNTRY.Items.Insert(i + 1, new ListItem(COUNTRY_TW[i], COUNTRY_EN[i]));
						drpINVOICE_COUNTRY.Items.Insert(i + 1, new ListItem(COUNTRY_TW[i], COUNTRY_EN[i]));
					}
				}
				else
				{
					for (i = 0; i <= 221; i++)
					{
						drpCOUNTRY.Items.Insert(i + 1, new ListItem(COUNTRY_EN[i], COUNTRY_EN[i]));
						drpINVOICE_COUNTRY.Items.Insert(i + 1, new ListItem(COUNTRY_EN[i], COUNTRY_EN[i]));
					}
				}
				
			}
			catch (Exception ex)
			{
				showException(ex.Message);
			}
			finally
			{
			}
			return result;
		}
		//Private Function getPAYMENT_TERM() As Boolean
		//    Dim result As Boolean = False
		//    Dim i As Integer
		//    Try
		//        ' 將資料寫入下拉式選單
		//        Dim ds As DataSet = PAYMENT_TERM_NO()
		//        If (Not ds Is Nothing AndAlso ds.Tables.Count > 0) Then
		//            If (Not ds Is Nothing AndAlso ds.Tables(0).Rows(0)("ReturnCode") <> "100" AndAlso ds.Tables(0).Rows(0)("ReturnCode") <> "999") Then
		//                drpPAYMENT_TERM_NO.DataSource = ds.Tables("BAS_PAYMENT_TERM")
		//                drpPAYMENT_TERM_NO.DataTextField = "DESCRIPTION"
		//                drpPAYMENT_TERM_NO.DataValueField = "PAYMENT_TERM_NO"
		//                drpPAYMENT_TERM_NO.DataBind()
		//            Else
		//                drpPAYMENT_TERM_NO.Items.Insert(0, New ListItem("", ""))
		
		//            End If
		//            drpPAYMENT_TERM_NO.Items.Insert(0, New ListItem("Select", ""))
		//        End If
		//    Catch ex As Exception
		//        showException(ex.Message)
		//    Finally
		//    End Try
		//    Return result
		//End Function
		
		public DataSet PAYMENT_TERM_NO()
		{
			DataSet dsReturn = default(DataSet);
			
			try
			{
				// 查詢資料總筆數之 sql command
				StringBuilder sb = new StringBuilder();
				sb.Append("Select PAYMENT_TERM_NO,(PAYMENT_TERM_NO||\'-\'||DESCRIPTION) DESCRIPTION From BAS_PAYMENT_TERM order by PAYMENT_TERM_NO ");
				// DataTable Name
				string dtName = "BAS_PAYMENT_TERM";
				// Sql command
				string sqlCommands = sb.ToString();
				// create database access object
				dbAccess dba = new dbAccess();
				dsReturn = dba.runExecuteQuery(dtName, sqlCommands);
				
			}
			catch (Exception ex)
			{
				// create return object (DataSet)
				dsReturn = new DataSet("BAS_PAYMENT_TERM");
				dsReturn.Tables.Add(createErrorTable(ex.Message));
			}
			
			return dsReturn;
		}
		
		
		private bool getCLASS()
		{
			bool result = false;
			int i;
			try
			{
				DataSet ds = VND_B2B_CLASS();
				// 將資料寫入下拉式選單
				if (Session["langauage"] == "zh-tw")
				{
					
					if (!(ds == null) && ds.Tables.Count > 0)
					{
						if (!(ds == null) && ds.Tables[0].Rows[0]["ReturnCode"] != "100" && ds.Tables[0].Rows[0]["ReturnCode"] != "999")
						{
							drpVENDOR_KIND.DataSource = ds.Tables["VND_B2B_CLASS"];
							drpVENDOR_KIND.DataTextField = "DESCRIPTION_CHINESE";
							drpVENDOR_KIND.DataValueField = "B2B_CLASS_CODE";
							drpVENDOR_KIND.DataBind();
						}
						else
						{
							drpVENDOR_KIND.Items.Insert(0, new ListItem("", ""));
							
						}
						int COUNT = ds.Tables["VND_B2B_CLASS"].Rows.Count;
						
						drpVENDOR_KIND.Items.Insert(COUNT, new ListItem("CTM-海關", "CTM"));
						// drpVENDOR_KIND.Items.Insert(COUNT + 1, New ListItem("ESC-空廚", "ESC"))   'VER 1.2   20080903  Joe       刪除廠商類別 ESC
						drpVENDOR_KIND.Items.Insert(COUNT + 1, new ListItem("EIC-管理總部", "EIC")); //VER 1.1   20080508  EmilyLi   P3108M0374  新增廠商類別 EIC
					}
				}
				else
				{
					if (!(ds == null) && ds.Tables.Count > 0)
					{
						if (!(ds == null) && ds.Tables[0].Rows[0]["ReturnCode"] != "100" && ds.Tables[0].Rows[0]["ReturnCode"] != "999")
						{
							drpVENDOR_KIND.DataSource = ds.Tables["VND_B2B_CLASS"];
							drpVENDOR_KIND.DataTextField = "DESCRIPTION_ENGLISH";
							drpVENDOR_KIND.DataValueField = "B2B_CLASS_CODE";
							drpVENDOR_KIND.DataBind();
						}
						else
						{
							drpVENDOR_KIND.Items.Insert(0, new ListItem("", ""));
							
						}
						int COUNT = ds.Tables["VND_B2B_CLASS"].Rows.Count;
						
						drpVENDOR_KIND.Items.Insert(COUNT, new ListItem("CUSTOMS", "CTM"));
						drpVENDOR_KIND.Items.Insert(COUNT + 1, new ListItem("CATERER", "ESC"));
					}
					
					
					
				}
				
			}
			catch (Exception ex)
			{
				showException(ex.Message);
			}
			finally
			{
			}
			return result;
		}
		public DataSet VND_B2B_CLASS()
		{
			DataSet dsReturn = default(DataSet);
			try
			{
				// 查詢資料總筆數之 sql command
				
				
				StringBuilder sb = new StringBuilder();
				sb.Append("Select  B2B_CLASS_CODE,(B2B_CLASS_CODE ||\'-\'||DESCRIPTION_CHINESE)DESCRIPTION_CHINESE,(B2B_CLASS_CODE ||\'-\'||DESCRIPTION_ENGLISH)DESCRIPTION_ENGLISH  From VND_B2B_CLASS Where status = \'1\' ");
				
				// DataTable Name
				string dtName = "VND_B2B_CLASS";
				// Sql command
				string sqlCommands = sb.ToString();
				// create database access object
				dbAccess dba = new dbAccess();
				dsReturn = dba.runExecuteQuery(dtName, sqlCommands);
			}
			catch (Exception ex)
			{
				dsReturn = new DataSet("VND_B2B_CLASS");
				dsReturn.Tables.Add(createErrorTable(ex.Message));
			}
			
			return dsReturn;
		}
		private bool getCURRENCY_TYPE()
		{
			bool result = false;
			int i;
			try
			{
				// 將資料寫入下拉式選單
				DataSet ds = drpCURRENCY_TYPE_NO();
				if (!(ds == null) && ds.Tables.Count > 0)
				{
					if (!(ds == null) && ds.Tables[0].Rows[0]["ReturnCode"] != "100" && ds.Tables[0].Rows[0]["ReturnCode"] != "999")
					{
						drpCURRENCY_TYPE.DataSource = ds.Tables["BAS_CURRENCY"];
						drpCURRENCY_TYPE.DataTextField = "DESCRIPTION";
						drpCURRENCY_TYPE.DataValueField = "CURRENCY_TYPE";
						drpCURRENCY_TYPE.DataBind();
					}
					else
					{
						drpCURRENCY_TYPE.Items.Insert(0, new ListItem("", ""));
					}
				}
			}
			catch (Exception ex)
			{
				showException(ex.Message);
			}
			finally
			{
			}
			return result;
		}
		
		private bool getCURRENCY()
		{
			bool result = false;
			int i;
			try
			{
				// 將資料寫入下拉式選單
				DataSet ds = drpCURRENCY_TYPE_NO();
				if (!(ds == null) && ds.Tables.Count > 0)
				{
					if (!(ds == null) && ds.Tables[0].Rows[0]["ReturnCode"] != "100" && ds.Tables[0].Rows[0]["ReturnCode"] != "999")
					{
						drpCURRENCY_1.DataSource = ds.Tables["BAS_CURRENCY"];
						drpCURRENCY_1.DataTextField = "DESCRIPTION";
						drpCURRENCY_1.DataValueField = "CURRENCY_TYPE";
						drpCURRENCY_1.DataBind();
						drpCURRENCY_2.DataSource = ds.Tables["BAS_CURRENCY"];
						drpCURRENCY_2.DataTextField = "DESCRIPTION";
						drpCURRENCY_2.DataValueField = "CURRENCY_TYPE";
						drpCURRENCY_2.DataBind();
						drpCURRENCY_3.DataSource = ds.Tables["BAS_CURRENCY"];
						drpCURRENCY_3.DataTextField = "DESCRIPTION";
						drpCURRENCY_3.DataValueField = "CURRENCY_TYPE";
						drpCURRENCY_3.DataBind();
					}
					else
					{
						drpCURRENCY_1.Items.Insert(0, new ListItem("", ""));
						drpCURRENCY_2.Items.Insert(0, new ListItem("", ""));
						drpCURRENCY_3.Items.Insert(0, new ListItem("", ""));
					}
					drpCURRENCY_1.Items.Insert(0, new ListItem("Select", ""));
					drpCURRENCY_2.Items.Insert(0, new ListItem("Select", ""));
					drpCURRENCY_3.Items.Insert(0, new ListItem("Select", ""));
				}
			}
			catch (Exception ex)
			{
				showException(ex.Message);
			}
			finally
			{
			}
			return result;
		}
		
		public DataSet drpCURRENCY_TYPE_NO()
		{
			DataSet dsReturn = default(DataSet);
			try
			{
				StringBuilder sb = new StringBuilder();
				sb.Append("select CURRENCY_TYPE,(CURRENCY_TYPE||\'-\'||DESCRIPTION)DESCRIPTION from BAS_CURRENCY order by CURRENCY_TYPE  ");
				string dtName = "BAS_CURRENCY";
				string sqlCommands = sb.ToString();
				dbAccess dba = new dbAccess();
				dsReturn = dba.runExecuteQuery(dtName, sqlCommands);
			}
			catch (Exception ex)
			{
				dsReturn = new DataSet("BAS_CURRENCY");
				dsReturn.Tables.Add(createErrorTable(ex.Message));
			}
			return dsReturn;
		}
		
		private DataTable createErrorTable(string mError)
		{
			
			dbReturnInfo dbInfo = new dbReturnInfo("info");
			dbInfo.AddNewRow();
			dbInfo.setReturnDataValue("F", System.Convert.ToString(999), 0, mError);
			return dbInfo.getReturnDataTable();
		}
		public DataSet Query_VENDOR_NO(com.ddsc.common.ddscDataSet p_ddscDt)
		{
			DataSet dsReturn = default(DataSet);
			DataSet ds = p_ddscDt.getDataSet();

			string VENDOR_NO = "";
			try
			{
				
				// 查詢資料總筆數之 sql command
				StringBuilder sb = new StringBuilder();
				VENDOR_NO = ds.Tables[0].Rows[1]["VENDOR_NO"].ToString();
				sb.Append("Select * From VND_B2B_VENDOR ");
				//sb.Append("Where VENDOR_NO = \'" + VENDOR_NO + "\'");
                sb.Append("Where VENDOR_NO = \' :VENDORNO\'");
				// DataTable Name
				string dtName = "VND_B2B_VENDOR";
				
				// Sql command
				string sqlCommands = sb.ToString();
				
				// create database access object
                dbAccess dba = new dbAccess();
                ArrayList m_arrParam = new ArrayList();
                //Ken : 2.設定動態參數物件
                m_arrParam.Add(dba.GetOracleParam(":VENDORNO", VENDOR_NO));
                //Ken : 3.修改執行方法Overload
				dsReturn = dba.runExecuteQuery(dtName, sqlCommands,m_arrParam);
			}
			catch (Exception ex)
			{
				// create return object (DataSet)
				dsReturn = new DataSet("VND_B2B_VENDOR");
				dsReturn.Tables.Add(createErrorTable(ex.Message));
			}
			
			return dsReturn;
		}
		
#endregion
		
		private void Page_Load(System.Object sender, System.EventArgs e)
		{
			//在這裡放置使用者程式碼以初始化網頁
			// 載入權限資料 (從 session 中取得)
			this.btnSave.Click+=btnSave_Click;			
            try
			{
				if (!Page.IsPostBack)
				{
					// Dim action As String = "ADD"
					VENDOR LoginUser = default(VENDOR);
					getCURRENCY_TYPE();
					//     getPAYMENT_TERM()
					getCOUNTRY();
					getCLASS();
					
					this.txtUPD_DATE.Enabled = false;
					this.txtCRT_DATE.Enabled = false;
					//  Select Case action
					if ((string) (Page.Request["action_type"].ToUpper()) == "ADD")
					{
						// 新增模式
						DIV1.Visible = true;
						DIV2.Visible = false;
						DIV3.Visible = false;
						this.btnSave.Visible = true;
						btnCHANGE_PASSWORD.Visible = false;
						
						//Me.rdoCONSIGNED_FLAG.Enabled = True
					}
					else if ((string) (Page.Request["action_type"].ToUpper()) == "UPD")
					{
						LoginUser = GetLoginUser();
						// 修改模式
						//Me.txtVND_PASSWORD.Visible = False
						btnCHANGE_PASSWORD.Visible = true;
						//If LoginUser.CONSIGNED_FLAG = "C" Then
						//    DIV2.Visible = False
						//End If
						
						//Dim strPkey As String = Me.Request("VENDOR_NO").ToString().Trim()
						// 指定btnSave的onclick
						this.txtVENDOR_NO.EnableView = true;
						this.rdoVENDOR_TYPE.Enabled = false;
						//  Me.rdoCONSIGNED_FLAG.Enabled = False
						
						this.btnSave.Visible = true;
						DIV1.Visible = true;
						
						string strPkey = LoginUser.VENDOR_NO;
						//至db 查詢正在修改的這一筆
						//DataBase DataBase = new DataBase();
						DataSet ds = default(DataSet);
                        dbAccess dba = new dbAccess();
                        ArrayList m_arrParam = new ArrayList();
						string SelectCommand = "";
						if (LoginUser.B2B_STATUS == "0" || LoginUser.B2B_STATUS == "")
						{
							//SelectCommand = string.Format("select distinct * from vnd_vendor a ,(select VENDOR_NO b2bVendor_NO, BANK_NAME,BANK_ADDRESS,ABA_NO,SORT_CODE,CHIPS,FEDWIRE_NO,IACH,LOCAL_CLEARING_BANK_CODE,ACH,OTHERS,SWIFT_CODE,CURRENCY_1,CURRENCY_2,CURRENCY_3,AC_NO_1,AC_NO_2,AC_NO_3,BENEFICIARY_NAME,INTERMEDIARY_BANK_NAME,INTERMEDIARY_BANK_ADDRESS,INTERMEDIARY_BANK_SWIFT_CODE,VENDOR_KIND,PROFILE_PRODUCT from vnd_b2b_vendor) b where a.VENDOR_NO=b.b2bVendor_NO(+) and VENDOR_NO= \'{0}\'", strPkey);
                            SelectCommand = "select distinct * from vnd_vendor a ,(select VENDOR_NO b2bVendor_NO, BANK_NAME,BANK_ADDRESS,ABA_NO,SORT_CODE,CHIPS,FEDWIRE_NO,IACH,LOCAL_CLEARING_BANK_CODE,ACH,OTHERS,SWIFT_CODE,CURRENCY_1,CURRENCY_2,CURRENCY_3,AC_NO_1,AC_NO_2,AC_NO_3,BENEFICIARY_NAME,INTERMEDIARY_BANK_NAME,INTERMEDIARY_BANK_ADDRESS,INTERMEDIARY_BANK_SWIFT_CODE,VENDOR_KIND,PROFILE_PRODUCT from vnd_b2b_vendor) b where a.VENDOR_NO=b.b2bVendor_NO(+) and VENDOR_NO= :strPkey";
						
                        }
						else
						{
							//SelectCommand = string.Format("select * from  VND_B2B_VENDOR WHERE VENDOR_NO= \'{0}\'", strPkey);
                            SelectCommand = "select * from  VND_B2B_VENDOR WHERE VENDOR_NO= :strPkey";
						}
                        //Ken : 2.設定動態參數物件
                        m_arrParam.Add(dba.GetOracleParam(":strPkey", strPkey));
                         //Ken : 3.修改執行方法Overload
                		//ds = DataBase.Query_CLASS(SelectCommand, "VND_B2B_VENDOR");
                        ds = dba.runExecuteQuery("VND_B2B_VENDOR",SelectCommand, m_arrParam);
						int Row = 0;
						if (!(ds == null) && ds.Tables["info"].Rows[0]["ReturnCode"] != "100" && ds.Tables["info"].Rows[0]["ReturnCode"] != "999")
						{
							Row = System.Convert.ToInt32(ds.Tables["VND_B2B_VENDOR"].Rows.Count - 1);
							this.txtVENDOR_NO.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["VENDOR_NO"].ToString());
							this.txtVENDOR_CHINESENAME.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["VENDOR_NAME_CHINESE"].ToString());
							this.txtVENDOR_ENGLISHNAME.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["VENDOR_NAME_ENGLISH"].ToString());
							this.rdoVENDOR_TYPE.SelectedValue = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["VENDOR_TYPE"].ToString());
							if (LoginUser.B2B_FLAG_STATUS != "")
							{
								
								if (int.Parse(LoginUser.B2B_FLAG_STATUS) >= 2 || int.Parse(LoginUser.B2B_STATUS) == 0)
								{
									getCURRENCY();
									if (this.rdoVENDOR_TYPE.SelectedValue == "D")
									{
										DIV3.Visible = false;
									}
								}
								else
								{
									DIV2.Visible = false;
									DIV3.Visible = false;
									
								}
							}
							else
							{
								DIV2.Visible = false;
								DIV3.Visible = false;
							}
							this.txtPROFILE_PRODUCT.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["PROFILE_PRODUCT"].ToString());
							string COUNTRY = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[0]["COUNTRY"].ToString());
							if (this.drpCOUNTRY.Items.IndexOf(this.drpCOUNTRY.Items.FindByValue(COUNTRY)) != -1)
							{
								this.drpCOUNTRY.SelectedIndex = this.drpCOUNTRY.Items.IndexOf(this.drpCOUNTRY.Items.FindByValue(COUNTRY));
							}
							else
							{
								this.drpCOUNTRY.Items.Insert(0, new ListItem(COUNTRY, "NULL"));
							}
							// Me.drpCOUNTRY.SelectedValue = ds.Tables("VND_B2B_VENDOR").Rows(Row)("COUNTRY").ToString()
							string CURRENCY_TYPE = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[0]["CURRENCY_TYPE"].ToString());
							if (this.drpCURRENCY_TYPE.Items.IndexOf(this.drpCURRENCY_TYPE.Items.FindByValue(CURRENCY_TYPE)) != -1)
							{
								this.drpCURRENCY_TYPE.SelectedIndex = this.drpCURRENCY_TYPE.Items.IndexOf(this.drpCURRENCY_TYPE.Items.FindByValue(CURRENCY_TYPE));
							}
							else
							{
								this.drpCURRENCY_TYPE.Items.Insert(0, new ListItem(CURRENCY_TYPE, "NULL"));
							}
							//Me.drpCURRENCY_TYPE.SelectedValue = ds.Tables("VND_B2B_VENDOR").Rows(Row)("CURRENCY_TYPE").ToString()
							this.txtAREA_CODE.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["AREA_CODE"].ToString());
							this.txtADDRESS.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["ADDRESS"].ToString());
							//Me.rdoCONSIGNED_FLAG.SelectedValue = ds.Tables("VND_B2B_VENDOR").Rows(Row)("CONSIGNED_FLAG").ToString()
							string INVOICE_COUNTRY = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[0]["INVOICE_COUNTRY"].ToString());
							if (this.drpINVOICE_COUNTRY.Items.IndexOf(this.drpINVOICE_COUNTRY.Items.FindByValue(INVOICE_COUNTRY)) != -1)
							{
								this.drpINVOICE_COUNTRY.SelectedIndex = this.drpINVOICE_COUNTRY.Items.IndexOf(this.drpINVOICE_COUNTRY.Items.FindByValue(INVOICE_COUNTRY));
							}
							else
							{
								this.drpINVOICE_COUNTRY.Items.Insert(0, new ListItem(INVOICE_COUNTRY, "NULL"));
							}
							//  Me.drpINVOICE_COUNTRY.SelectedValue = ds.Tables("VND_B2B_VENDOR").Rows(Row)("INVOICE_COUNTRY").ToString()
							this.txtINVOICE_CITY.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["INVOICE_CITY"].ToString());
							this.txtINVOICE_STATE.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["INVOICE_STATE"].ToString());
							this.txtINVOICE_ADDRESS.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["INVOICE_ADDRESS"].ToString());
							this.txtAGENT.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["AGENT"].ToString());
							this.txtAGENT_ADDRESS.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["AGENT_ADDRESS"].ToString());
							this.txtCLERK.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["CLERK"].ToString());
							this.txtCLERK_ADDRESS.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["CLERK_ADDRESS"].ToString());
							this.txtMAIL_ADDRESS.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["MAIL_ADDRESS"].ToString());
							this.txtCRT_DATE.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["CRT_DATE"].ToString());
							this.txtUPD_DATE.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["UPD_DATE"].ToString());
							// Dim DELIVERY_TERM As String = ds.Tables("VND_B2B_VENDOR").Rows(0)("DELIVERY_TERM").ToString()
							
							//If DELIVERY_TERM.Length > 11 Then
							//    If DELIVERY_TERM.Substring(0, 11) = "FOB_Seaport" Then
							
							//        Me.txtSEAPORT.Text = DELIVERY_TERM.Substring(11, DELIVERY_TERM.Length - 11)
							//        DELIVERY_TERM = "FOB_Seaport"
							//    End If
							//End If
							
							//If Me.drpDELIVERY_TERM.Items.IndexOf(Me.drpDELIVERY_TERM.Items.FindByValue(DELIVERY_TERM)) <> -1 Then
							//    Me.drpDELIVERY_TERM.SelectedIndex = Me.drpDELIVERY_TERM.Items.IndexOf(Me.drpDELIVERY_TERM.Items.FindByValue(DELIVERY_TERM))
							//Else
							//    Me.drpDELIVERY_TERM.Items.Insert(0, New ListItem(DELIVERY_TERM, "NULL"))
							//End If
							// Me.drpDELIVERY_TERM.SelectedValue = ds.Tables("VND_B2B_VENDOR").Rows(Row)("DELIVERY_TERM").ToString()
							string VENDOR_KIND = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[0]["VENDOR_KIND"].ToString());
							if (this.drpVENDOR_KIND.Items.IndexOf(this.drpVENDOR_KIND.Items.FindByValue(VENDOR_KIND)) != -1)
							{
								this.drpVENDOR_KIND.SelectedIndex = this.drpVENDOR_KIND.Items.IndexOf(this.drpVENDOR_KIND.Items.FindByValue(VENDOR_KIND));
							}
							else
							{
								this.drpVENDOR_KIND.Items.Insert(0, new ListItem(VENDOR_KIND, VENDOR_KIND));
							}
							
							//Dim PAYMENT_TERM_NO As String = ds.Tables("VND_B2B_VENDOR").Rows(0)("PAYMENT_TERM_NO").ToString()
							//If Me.drpPAYMENT_TERM_NO.Items.IndexOf(Me.drpPAYMENT_TERM_NO.Items.FindByValue(PAYMENT_TERM_NO)) <> -1 Then
							//    Me.drpPAYMENT_TERM_NO.SelectedIndex = Me.drpPAYMENT_TERM_NO.Items.IndexOf(Me.drpPAYMENT_TERM_NO.Items.FindByValue(PAYMENT_TERM_NO))
							//Else
							//    Me.drpPAYMENT_TERM_NO.Items.Insert(0, New ListItem(PAYMENT_TERM_NO, "NULL"))
							//End If
							
							//Me.drpPAYMENT_TERM_NO.SelectedValue = ds.Tables("VND_B2B_VENDOR").Rows(Row)("PAYMENT_TERM_NO").ToString()
							this.txtTEL1.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["tel1"].ToString());
							this.txtTEL2.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["tel2"].ToString());
							this.txtFAX1.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["fax1"].ToString());
							this.txtFAX2.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["fax2"].ToString());
							this.txtE_MAIL1.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["e_mail1"].ToString());
							this.txtE_MAIL2.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["e_mail2"].ToString());
							this.txtE_MAIL3.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["e_mail3"].ToString());
							this.txtWEBSITE.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["WEBSITE"].ToString());
							this.txtAUTHENTICATION.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["AUTHENTICATION"].ToString());
							this.txtCOOPERATION.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["COOPERATION"].ToString());
							if (LoginUser.B2B_FLAG_STATUS != "")
							{
								if (int.Parse(LoginUser.B2B_FLAG_STATUS) >= 2 || int.Parse(LoginUser.B2B_STATUS) == 0)
								{
									if (this.rdoVENDOR_TYPE.SelectedValue == "D")
									{
										//BENEFICIARYS_AC_NO
										this.txtBANK_NAME.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["BANK_NAME"].ToString());
										this.txtBENEFICIARY_NAME.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["VENDOR_NAME_CHINESE"].ToString());
										this.txtBANK_ADDRESS.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["BANK_ADDRESS"].ToString());
										string CURRENCY_1 = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[0]["CURRENCY_1"].ToString());
										if (this.drpCURRENCY_1.Items.IndexOf(this.drpCURRENCY_1.Items.FindByValue(CURRENCY_1)) != -1)
										{
											this.drpCURRENCY_1.SelectedIndex = this.drpCURRENCY_1.Items.IndexOf(this.drpCURRENCY_1.Items.FindByValue(CURRENCY_1));
										}
										else
										{
											this.drpCURRENCY_1.Items.Insert(0, new ListItem(CURRENCY_1, "NULL"));
										}
										string CURRENCY_2 = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[0]["CURRENCY_2"].ToString());
										if (this.drpCURRENCY_2.Items.IndexOf(this.drpCURRENCY_2.Items.FindByValue(CURRENCY_2)) != -1)
										{
											this.drpCURRENCY_2.SelectedIndex = this.drpCURRENCY_2.Items.IndexOf(this.drpCURRENCY_2.Items.FindByValue(CURRENCY_2));
										}
										else
										{
											this.drpCURRENCY_2.Items.Insert(0, new ListItem(CURRENCY_2, "NULL"));
										}
										string CURRENCY_3 = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[0]["CURRENCY_3"].ToString());
										if (this.drpCURRENCY_3.Items.IndexOf(this.drpCURRENCY_3.Items.FindByValue(CURRENCY_3)) != -1)
										{
											this.drpCURRENCY_3.SelectedIndex = this.drpCURRENCY_3.Items.IndexOf(this.drpCURRENCY_3.Items.FindByValue(CURRENCY_3));
										}
										else
										{
											this.drpCURRENCY_3.Items.Insert(0, new ListItem(CURRENCY_3, "NULL"));
										}
										this.txtAC_NO_1.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["AC_NO_1"].ToString());
										this.txtAC_NO_2.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["AC_NO_2"].ToString());
										this.txtAC_NO_3.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["AC_NO_3"].ToString());
									}
									else
									{
										//BENEFICIARYS_AC_NO
										this.txtBANK_NAME.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["BANK_NAME"].ToString());
										this.txtBENEFICIARY_NAME.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["VENDOR_NAME_ENGLISH"].ToString());
										this.txtBANK_ADDRESS.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["BANK_ADDRESS"].ToString());
										string CURRENCY_1 = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[0]["CURRENCY_1"].ToString());
										if (this.drpCURRENCY_1.Items.IndexOf(this.drpCURRENCY_1.Items.FindByValue(CURRENCY_1)) != -1)
										{
											this.drpCURRENCY_1.SelectedIndex = this.drpCURRENCY_1.Items.IndexOf(this.drpCURRENCY_1.Items.FindByValue(CURRENCY_1));
										}
										else
										{
											this.drpCURRENCY_1.Items.Insert(0, new ListItem(CURRENCY_1, "NULL"));
										}
										string CURRENCY_2 = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[0]["CURRENCY_2"].ToString());
										if (this.drpCURRENCY_2.Items.IndexOf(this.drpCURRENCY_2.Items.FindByValue(CURRENCY_2)) != -1)
										{
											this.drpCURRENCY_2.SelectedIndex = this.drpCURRENCY_2.Items.IndexOf(this.drpCURRENCY_2.Items.FindByValue(CURRENCY_2));
										}
										else
										{
											this.drpCURRENCY_2.Items.Insert(0, new ListItem(CURRENCY_2, "NULL"));
										}
										string CURRENCY_3 = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[0]["CURRENCY_3"].ToString());
										if (this.drpCURRENCY_3.Items.IndexOf(this.drpCURRENCY_3.Items.FindByValue(CURRENCY_3)) != -1)
										{
											this.drpCURRENCY_3.SelectedIndex = this.drpCURRENCY_3.Items.IndexOf(this.drpCURRENCY_3.Items.FindByValue(CURRENCY_3));
										}
										else
										{
											this.drpCURRENCY_3.Items.Insert(0, new ListItem(CURRENCY_3, "NULL"));
										}
										this.txtAC_NO_1.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["AC_NO_1"].ToString());
										this.txtAC_NO_2.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["AC_NO_2"].ToString());
										this.txtAC_NO_3.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["AC_NO_3"].ToString());
										//BANK_CODE_DETAILS
										this.txtABA_NO.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["ABA_NO"].ToString());
										this.txtSORT_CODE.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["SORT_CODE"].ToString());
										this.txtCHIPS.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["CHIPS"].ToString());
										this.txtFEDWIRD_NO.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["FEDWIRE_NO"].ToString());
										this.txtIACH.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["IACH"].ToString());
										this.txtLOCAL_CLEARING_BANK_CODE.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["LOCAL_CLEARING_BANK_CODE"].ToString());
										this.txtACH.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["ACH"].ToString());
										this.txtOTHERS.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["OTHERS"].ToString());
										this.txtSWIFT_CODE.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["SWIFT_CODE"].ToString());
										this.txtINTERMEDIARY_BANK_NAME.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["INTERMEDIARY_BANK_NAME"].ToString());
										this.txtINTERMEDIARY_BANK_ADDRESS.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["INTERMEDIARY_BANK_ADDRESS"].ToString());
										this.txtINTERMEDIARY_BANK_SWIFT_CODE.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["INTERMEDIARY_BANK_SWIFT_CODE"].ToString());
										
									}
								}
							}
							
						}
						else
						{
							showException("對不起! 此筆資料，已被刪除");
						}
						
						
						
					}
					else if ((string) (Page.Request["action_type"].ToUpper()) == "FIND")
					{
						// 查詢模式
						// 修改模式
						LoginUser = GetLoginUser();
						// Dim LoginUser As VENDOR = GetLoginUser()
						//Dim strPkey As String = Me.Request("VENDOR_NO").ToString().Trim()
						// 指定btnSave的onclick
						this.btnSave.Visible = true;
						DIV1.Visible = true;
						DIV2.Visible = true;
						string strPkey = LoginUser.VENDOR_NO;
						//至db 查詢正在修改的這一筆
						string SelectCommand = "select * from  VND_B2B_VENDOR WHERE VENDOR_NO= :strPkey";
						//DataBase DataBase = new DataBase();
						DataSet ds = default(DataSet);
                        dbAccess dba = new dbAccess();
                        ArrayList m_arrParam = new ArrayList();
                         //Ken : 2.設定動態參數物件
                        m_arrParam.Add(dba.GetOracleParam(":strPkey", strPkey));
                         //Ken : 3.修改執行方法Overload
                		//ds = DataBase.Query_CLASS(SelectCommand, "VND_B2B_VENDOR");
                        ds = dba.runExecuteQuery("VND_B2B_VENDOR",SelectCommand, m_arrParam);
						
						int Row = 0;
						if (!(ds == null) && ds.Tables["info"].Rows[0]["ReturnCode"] != "100" && ds.Tables["info"].Rows[0]["ReturnCode"] != "999")
						{
							Row = System.Convert.ToInt32(ds.Tables["VND_B2B_VENDOR"].Rows.Count - 1);
							this.txtVENDOR_NO.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["VENDOR_NO"].ToString());
							this.txtVENDOR_CHINESENAME.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["VENDOR_NAME_CHINESE"].ToString());
							this.txtVENDOR_ENGLISHNAME.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["VENDOR_NAME_ENGLISH"].ToString());
							this.rdoVENDOR_TYPE.SelectedValue = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["VENDOR_TYPE"].ToString());
							if (int.Parse(LoginUser.B2B_STATUS) >= 2 || int.Parse(LoginUser.B2B_STATUS) == 0)
							{
								getCURRENCY();
								if (this.rdoVENDOR_TYPE.SelectedValue == "D")
								{
									DIV3.Visible = false;
								}
							}
							else
							{
								DIV2.Visible = false;
								DIV3.Visible = false;
								
							}
							this.txtPROFILE_PRODUCT.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["PROFILE_PRODUCT"].ToString());
							
							string COUNTRY = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[0]["COUNTRY"].ToString());
							if (this.drpCOUNTRY.Items.IndexOf(this.drpCOUNTRY.Items.FindByValue(COUNTRY)) != -1)
							{
								this.drpCOUNTRY.SelectedIndex = this.drpCOUNTRY.Items.IndexOf(this.drpCOUNTRY.Items.FindByValue(COUNTRY));
							}
							else
							{
								this.drpCOUNTRY.Items.Insert(0, new ListItem(COUNTRY, "NULL"));
							}
							// Me.drpCOUNTRY.SelectedValue = ds.Tables("VND_B2B_VENDOR").Rows(Row)("COUNTRY").ToString()
							string CURRENCY_TYPE = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[0]["CURRENCY_TYPE"].ToString());
							if (this.drpCURRENCY_TYPE.Items.IndexOf(this.drpCURRENCY_TYPE.Items.FindByValue(CURRENCY_TYPE)) != -1)
							{
								this.drpCURRENCY_TYPE.SelectedIndex = this.drpCURRENCY_TYPE.Items.IndexOf(this.drpCURRENCY_TYPE.Items.FindByValue(CURRENCY_TYPE));
							}
							else
							{
								this.drpCOUNTRY.Items.Insert(0, new ListItem(COUNTRY, "NULL"));
							}
							//Me.drpCURRENCY_TYPE.SelectedValue = ds.Tables("VND_B2B_VENDOR").Rows(Row)("CURRENCY_TYPE").ToString()
							this.txtAREA_CODE.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["AREA_CODE"].ToString());
							this.txtADDRESS.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["ADDRESS"].ToString());
							this.txtFEDWIRD_NO.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["FEDWIRE_NO"].ToString());
							// Me.rdoCONSIGNED_FLAG.SelectedValue = ds.Tables("VND_B2B_VENDOR").Rows(Row)("CONSIGNED_FLAG").ToString()
							string INVOICE_COUNTRY = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[0]["INVOICE_COUNTRY"].ToString());
							if (this.drpINVOICE_COUNTRY.Items.IndexOf(this.drpINVOICE_COUNTRY.Items.FindByValue(INVOICE_COUNTRY)) != -1)
							{
								this.drpINVOICE_COUNTRY.SelectedIndex = this.drpINVOICE_COUNTRY.Items.IndexOf(this.drpINVOICE_COUNTRY.Items.FindByValue(INVOICE_COUNTRY));
							}
							else
							{
								this.drpINVOICE_COUNTRY.Items.Insert(0, new ListItem(INVOICE_COUNTRY, "NULL"));
							}
							//  Me.drpINVOICE_COUNTRY.SelectedValue = ds.Tables("VND_B2B_VENDOR").Rows(Row)("INVOICE_COUNTRY").ToString()
							this.txtINVOICE_CITY.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["INVOICE_CITY"].ToString());
							this.txtINVOICE_STATE.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["INVOICE_STATE"].ToString());
							this.txtINVOICE_ADDRESS.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["INVOICE_ADDRESS"].ToString());
							this.txtAGENT.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["AGENT"].ToString());
							this.txtAGENT_ADDRESS.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["AGENT_ADDRESS"].ToString());
							this.txtCLERK.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["CLERK"].ToString());
							this.txtCLERK_ADDRESS.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["CLERK_ADDRESS"].ToString());
							this.txtMAIL_ADDRESS.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["MAIL_ADDRESS"].ToString());
							//Dim DELIVERY_TERM As String = ds.Tables("VND_B2B_VENDOR").Rows(0)("DELIVERY_TERM").ToString()
							//If DELIVERY_TERM.Length > 11 Then
							//    If DELIVERY_TERM.Substring(0, 11) = "FOB_Seaport" Then
							//        Me.txtSEAPORT.Text = DELIVERY_TERM.Substring(11, DELIVERY_TERM.Length - 11)
							//        DELIVERY_TERM = "FOB_Seaport"
							//    End If
							//End If
							//If Me.drpDELIVERY_TERM.Items.IndexOf(Me.drpDELIVERY_TERM.Items.FindByValue(DELIVERY_TERM)) <> -1 Then
							//    Me.drpDELIVERY_TERM.SelectedIndex = Me.drpDELIVERY_TERM.Items.IndexOf(Me.drpDELIVERY_TERM.Items.FindByValue(DELIVERY_TERM))
							//Else
							//    Me.drpDELIVERY_TERM.Items.Insert(0, New ListItem(INVOICE_COUNTRY, "NULL"))
							//End If
							//' Me.drpDELIVERY_TERM.SelectedValue = ds.Tables("VND_B2B_VENDOR").Rows(Row)("DELIVERY_TERM").ToString()
							//Dim PAYMENT_TERM_NO As String = ds.Tables("VND_B2B_VENDOR").Rows(0)("PAYMENT_TERM_NO").ToString()
							//If Me.drpPAYMENT_TERM_NO.Items.IndexOf(Me.drpPAYMENT_TERM_NO.Items.FindByValue(PAYMENT_TERM_NO)) <> -1 Then
							//    Me.drpPAYMENT_TERM_NO.SelectedIndex = Me.drpPAYMENT_TERM_NO.Items.IndexOf(Me.drpPAYMENT_TERM_NO.Items.FindByValue(PAYMENT_TERM_NO))
							//Else
							//    Me.drpPAYMENT_TERM_NO.Items.Insert(0, New ListItem(INVOICE_COUNTRY, "NULL"))
							//End If
							string VENDOR_KIND = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[0]["VENDOR_KIND"].ToString());
							if (this.drpVENDOR_KIND.Items.IndexOf(this.drpVENDOR_KIND.Items.FindByValue(VENDOR_KIND)) != -1)
							{
								this.drpVENDOR_KIND.SelectedIndex = this.drpVENDOR_KIND.Items.IndexOf(this.drpVENDOR_KIND.Items.FindByValue(VENDOR_KIND));
							}
							else
							{
								this.drpVENDOR_KIND.Items.Insert(0, new ListItem(VENDOR_KIND, "NULL"));
							}
							//Me.drpPAYMENT_TERM_NO.SelectedValue = ds.Tables("VND_B2B_VENDOR").Rows(Row)("PAYMENT_TERM_NO").ToString()
							this.txtTEL1.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["tel1"].ToString());
							this.txtTEL2.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["tel2"].ToString());
							this.txtFAX1.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["fax1"].ToString());
							this.txtFAX2.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["fax2"].ToString());
							this.txtE_MAIL1.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["e_mail1"].ToString());
							this.txtE_MAIL2.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["e_mail2"].ToString());
							this.txtE_MAIL3.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["e_mail3"].ToString());
							this.txtWEBSITE.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["WEBSITE"].ToString());
							this.txtAUTHENTICATION.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["AUTHENTICATION"].ToString());
							this.txtCOOPERATION.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["COOPERATION"].ToString());
							if (int.Parse(LoginUser.B2B_STATUS) >= 2 || int.Parse(LoginUser.B2B_STATUS) == 0)
							{
								if (this.rdoVENDOR_TYPE.SelectedValue == "D")
								{
									//BENEFICIARYS_AC_NO
									this.txtBANK_NAME.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["BANK_NAME"].ToString());
									this.txtBENEFICIARY_NAME.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["BENEFICIARY_NAME"].ToString());
									this.txtBANK_ADDRESS.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["BANK_ADDRESS"].ToString());
									string CURRENCY_1 = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[0]["CURRENCY_1"].ToString());
									if (this.drpCURRENCY_1.Items.IndexOf(this.drpCURRENCY_1.Items.FindByValue(CURRENCY_1)) != -1)
									{
										this.drpCURRENCY_1.SelectedIndex = this.drpCURRENCY_1.Items.IndexOf(this.drpCURRENCY_1.Items.FindByValue(CURRENCY_1));
									}
									else
									{
										this.drpCURRENCY_1.Items.Insert(0, new ListItem(CURRENCY_1, "NULL"));
									}
									string CURRENCY_2 = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[0]["CURRENCY_2"].ToString());
									if (this.drpCURRENCY_2.Items.IndexOf(this.drpCURRENCY_2.Items.FindByValue(CURRENCY_2)) != -1)
									{
										this.drpCURRENCY_2.SelectedIndex = this.drpCURRENCY_2.Items.IndexOf(this.drpCURRENCY_2.Items.FindByValue(CURRENCY_2));
									}
									else
									{
										this.drpCURRENCY_2.Items.Insert(0, new ListItem(CURRENCY_2, "NULL"));
									}
									string CURRENCY_3 = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[0]["CURRENCY_3"].ToString());
									if (this.drpCURRENCY_3.Items.IndexOf(this.drpCURRENCY_3.Items.FindByValue(CURRENCY_3)) != -1)
									{
										this.drpCURRENCY_3.SelectedIndex = this.drpCURRENCY_3.Items.IndexOf(this.drpCURRENCY_3.Items.FindByValue(CURRENCY_3));
									}
									else
									{
										this.drpCURRENCY_3.Items.Insert(0, new ListItem(CURRENCY_3, "NULL"));
									}
									this.txtAC_NO_1.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["AC_NO_1"].ToString());
									this.txtAC_NO_2.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["AC_NO_2"].ToString());
									this.txtAC_NO_3.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["AC_NO_3"].ToString());
								}
								else
								{
									//BENEFICIARYS_AC_NO
									this.txtBANK_NAME.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["BANK_NAME"].ToString());
									this.txtBENEFICIARY_NAME.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["BENEFICIARY_NAME"].ToString());
									this.txtBANK_ADDRESS.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["BANK_ADDRESS"].ToString());
									string CURRENCY_1 = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[0]["CURRENCY_1"].ToString());
									if (this.drpCURRENCY_1.Items.IndexOf(this.drpCURRENCY_1.Items.FindByValue(CURRENCY_1)) != -1)
									{
										this.drpCURRENCY_1.SelectedIndex = this.drpCURRENCY_1.Items.IndexOf(this.drpCURRENCY_1.Items.FindByValue(CURRENCY_1));
									}
									else
									{
										this.drpCURRENCY_1.Items.Insert(0, new ListItem(CURRENCY_1, "NULL"));
									}
									string CURRENCY_2 = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[0]["CURRENCY_2"].ToString());
									if (this.drpCURRENCY_2.Items.IndexOf(this.drpCURRENCY_2.Items.FindByValue(CURRENCY_2)) != -1)
									{
										this.drpCURRENCY_2.SelectedIndex = this.drpCURRENCY_2.Items.IndexOf(this.drpCURRENCY_2.Items.FindByValue(CURRENCY_2));
									}
									else
									{
										this.drpCURRENCY_2.Items.Insert(0, new ListItem(CURRENCY_2, "NULL"));
									}
									string CURRENCY_3 = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[0]["CURRENCY_3"].ToString());
									if (this.drpCURRENCY_3.Items.IndexOf(this.drpCURRENCY_3.Items.FindByValue(CURRENCY_3)) != -1)
									{
										this.drpCURRENCY_3.SelectedIndex = this.drpCURRENCY_3.Items.IndexOf(this.drpCURRENCY_3.Items.FindByValue(CURRENCY_3));
									}
									else
									{
										this.drpCURRENCY_3.Items.Insert(0, new ListItem(CURRENCY_3, "NULL"));
									}
									this.txtAC_NO_1.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["AC_NO_1"].ToString());
									this.txtAC_NO_2.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["AC_NO_2"].ToString());
									this.txtAC_NO_3.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["AC_NO_3"].ToString());
									//BANK_CODE_DETAILS
									this.txtABA_NO.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["ABA_NO"].ToString());
									this.txtSORT_CODE.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["SORT_CODE"].ToString());
									this.txtCHIPS.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["CHIPS"].ToString());
									this.txtFEDWIRD_NO.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["FEDWIRE_NO"].ToString());
									this.txtIACH.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["IACH"].ToString());
									this.txtLOCAL_CLEARING_BANK_CODE.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["LOCAL_CLEARING_BANK_CODE"].ToString());
									this.txtACH.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["ACH"].ToString());
									this.txtOTHERS.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["OTHERS"].ToString());
									this.txtSWIFT_CODE.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["SWIFT_CODE"].ToString());
									this.txtINTERMEDIARY_BANK_NAME.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["INTERMEDIARY_BANK_NAME"].ToString());
									this.txtINTERMEDIARY_BANK_ADDRESS.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["INTERMEDIARY_BANK_ADDRESS"].ToString());
									this.txtINTERMEDIARY_BANK_SWIFT_CODE.Text = System.Convert.ToString(ds.Tables["VND_B2B_VENDOR"].Rows[Row]["INTERMEDIARY_BANK_SWIFT_CODE"].ToString());
									
								}
								
							}
							
						}
						else
						{
							showException("對不起! 此筆資料，已被刪除");
						}
					}
					else if ((string) (Page.Request["action_type"].ToUpper()) == "PRT")
					{
						// 列印模式
					}
					else
					{
					}
				}
			}
			catch (Exception ex)
			{
				showException(ex.Message);
			}
		}
		
		private void addBASD010(string user)
		{
			// 設定傳送的 DataSet 物件
			com.ddsc.common.ddscDataSet ddscDs = new com.ddsc.common.ddscDataSet();
			com.ddsc.common.ddscDataTable ddscDt = ddscDs.createDataTable("VND_B2B_VENDOR");
			string SystemDate = DateTime.Now.ToString("yyyyMMdd");
			string SystemTime = DateTime.Now.ToString("HHmmss");
			// 宣告回傳DataSet
			DataSet dsResult = new DataSet();
			try
			{
				// 新增Row至ddscDt
				ddscDt.addNewRow();
				// 設定dscDt各欄位Value，參數一：columnName,參數二：columnValue
				ddscDt.setColumnValue("action", "string", "add");
				ddscDt.setColumnValue("VENDOR_TYPE", "string", rdoVENDOR_TYPE.SelectedValue);
				//ddscDt.setColumnValue("CONSIGNED_FLAG", "string", rdoCONSIGNED_FLAG.SelectedValue)
				string vendor_no = "";
				DataBase DataBase = new DataBase();
				if (rdoVENDOR_TYPE.SelectedValue == "F")
				{
					vendor_no = System.Convert.ToString(DataBase.GetDefaultTransactionNo("VR"));
					this.txtVENDOR_NO.Text = vendor_no;
					
				}
				else
				{
					vendor_no = this.txtVENDOR_NO.Text;
				}
				
				
				ddscDt.setColumnValue("VENDOR_NO", "string", vendor_no);
				
				ddscDt.setColumnValue("VENDOR_NAME_CHINESE", "string", txtVENDOR_CHINESENAME.Text.Trim());
				ddscDt.setColumnValue("VENDOR_NAME_ENGLISH", "string", txtVENDOR_ENGLISHNAME.Text.Trim());
				ddscDt.setColumnValue("VENDOR_NAME_ENGLISH", "string", txtVENDOR_ENGLISHNAME.Text.Trim());
				ddscDt.setColumnValue("PROFILE_PRODUCT", "string", txtPROFILE_PRODUCT.Text.Trim());
				ddscDt.setColumnValue("COUNTRY", "string", this.drpCOUNTRY.SelectedValue.Trim());
				ddscDt.setColumnValue("CURRENCY_TYPE", "string", System.Convert.ToString(this.drpCURRENCY_TYPE.Items[this.drpCURRENCY_TYPE.SelectedIndex].Value.Trim()));
				ddscDt.setColumnValue("AREA_CODE", "string", txtAREA_CODE.Text.Trim());
				ddscDt.setColumnValue("ADDRESS", "string", txtADDRESS.Text.Trim());
				ddscDt.setColumnValue("INVOICE_COUNTRY", "string", this.drpINVOICE_COUNTRY.SelectedValue.Trim());
				ddscDt.setColumnValue("INVOICE_CITY", "string", txtINVOICE_CITY.Text.Trim());
				ddscDt.setColumnValue("INVOICE_STATE", "string", txtINVOICE_STATE.Text.Trim());
				ddscDt.setColumnValue("INVOICE_ADDRESS", "string", txtINVOICE_ADDRESS.Text.Trim());
				ddscDt.setColumnValue("AGENT", "string", txtAGENT.Text.Trim());
				ddscDt.setColumnValue("AGENT_ADDRESS", "string", txtAGENT_ADDRESS.Text.Trim());
				ddscDt.setColumnValue("CLERK", "string", txtCLERK.Text.Trim());
				ddscDt.setColumnValue("CLERK_ADDRESS", "string", txtCLERK_ADDRESS.Text.Trim());
				ddscDt.setColumnValue("MAIL_ADDRESS", "string", txtMAIL_ADDRESS.Text.Trim());
                ddscDt.setColumnValue("FLAG_STATUS", "string","0");

				//Dim DELIVERY_TERM As String
				//If drpDELIVERY_TERM.SelectedValue = "FOB_Seaport" Then
				//    DELIVERY_TERM = drpDELIVERY_TERM.SelectedValue & Me.txtSEAPORT.Text
				//Else
				//    DELIVERY_TERM = drpDELIVERY_TERM.SelectedValue
				//End If
				//ddscDt.setColumnValue("DELIVERY_TERM", "string", DELIVERY_TERM)
				//ddscDt.setColumnValue("PAYMENT_TERM_NO", "string", Me.drpPAYMENT_TERM_NO.SelectedValue.Trim())
				ddscDt.setColumnValue("VENDOR_KIND", "string", this.drpVENDOR_KIND.SelectedValue.Trim());
				
				ddscDt.setColumnValue("tel1", "string", txtTEL1.Text.Trim());
				ddscDt.setColumnValue("tel2", "string", txtTEL2.Text.Trim());
				ddscDt.setColumnValue("fax1", "string", txtFAX1.Text.Trim());
				ddscDt.setColumnValue("fax2", "string", txtFAX2.Text.Trim());
				ddscDt.setColumnValue("e_mail1", "string", txtE_MAIL1.Text.Trim());
				ddscDt.setColumnValue("e_mail2", "string", txtE_MAIL2.Text.Trim());
				ddscDt.setColumnValue("e_mail3", "string", txtE_MAIL3.Text.Trim());
				ddscDt.setColumnValue("WEBSITE", "string", txtWEBSITE.Text.Trim());
				ddscDt.setColumnValue("AUTHENTICATION", "string", txtAUTHENTICATION.Text.Trim());
				ddscDt.setColumnValue("COOPERATION", "string", txtCOOPERATION.Text.Trim());
				
				
				
				ddscDt.setColumnValue("status", "string", "1");
				ddscDt.setColumnValue("crt_id", "string", vendor_no);
				ddscDt.setColumnValue("crt_date", "string", SystemDate);
				ddscDt.setColumnValue("crt_time", "string", SystemTime);
				ddscDs.addDataTable(ddscDt);
				// 執行編輯method
				//密碼加密rnd
				FunctionHandler FunctionHandler = new FunctionHandler();
				string PASSWORD = FunctionHandler.Encrypt(this.txtVND_PASSWORD.Text);
				com.ddsc.common.ddscDataTable ddscDtp = ddscDs.createDataTable("VND_VENDOR_AUTHORITY");
				ddscDtp.setColumnValue("action", "string", "add");
				ddscDtp.setColumnValue("VENDOR_NO", "string", vendor_no);
				ddscDtp.setColumnValue("VENDOR_PWD", "string", PASSWORD);
				ddscDtp.setColumnValue("status", "string", "1");
				ddscDtp.setColumnValue("crt_id", "string", vendor_no);
				ddscDtp.setColumnValue("crt_date", "string", SystemDate);
				ddscDtp.setColumnValue("crt_time", "string", SystemTime);
                ddscDtp.setColumnValue("UPT_id", "string", vendor_no);
                ddscDtp.setColumnValue("UPD_date", "string", SystemDate);
                ddscDtp.setColumnValue("UPD_time", "string", SystemTime);
				ddscDs.addDataTable(ddscDtp);
				
				dsResult = DataBase.Addition(ddscDs, "", (System.Array) null, (System.Array) null);
				//dsResult = Addition(ddscDs, "", Nothing, Nothing)
				// 寫入script至client端
				//regScript(dsResult, "upd")
				regScript_Vendor_maintain(dsResult, "add", this.lblVENDOR_NO.Text + ":" + this.txtVENDOR_NO.Text + "\\n", "0");
				string MailTo = "";
				string SelectCommand = string.Format("select APPLICANT,b.EMAIL from  VND_RELATED_USER A,psn_open_data B WHERE VENDOR_KIND=\'{0}\' and a.APPLICANT=b.EMPLOYEE_NO(+)", this.drpVENDOR_KIND.SelectedValue.Trim());
				DataSet ds = default(DataSet);
				ds = DataBase.Query_CLASS(SelectCommand, "VND_RELATED_USER");
				int Row = 0;
				if (!(ds == null) && ds.Tables["info"].Rows[0]["ReturnCode"] != "100" && ds.Tables["info"].Rows[0]["ReturnCode"] != "999")
				{
					for (Row = 0; Row <= ds.Tables["VND_RELATED_USER"].Rows.Count - 1; Row++)
					{
                        //MailTo = MailTo + ds.Tables["VND_RELATED_USER"].Rows[Row]["EMAIL"].ToString() + ";";

                        //fix mail from AD by employeeid
                        string empID = ds.Tables["VND_RELATED_USER"].Rows[Row]["APPLICANT"].ToString() ;

                        MailTo = MailTo + (new FunctionHandler()).QueryADInfo(empID , ADQueryType.Email) +  ";";


					}
					
				}
				string BODY = "";
				string VENDOR_NAME = "";
				string Subject = "";
				if (txtVENDOR_CHINESENAME.Text != "")
				{
					VENDOR_NAME = txtVENDOR_CHINESENAME.Text;
				}
				else if (txtVENDOR_ENGLISHNAME.Text != "")
				{
					VENDOR_NAME = txtVENDOR_ENGLISHNAME.Text;
				}
                dbAccess dba = new dbAccess();
                //SelectCommand = string.Format("SELECT M.CONFIG_TYPE,D.CONFIG_CHINESE_DESC,D.CONFIG_ENGLISH_DESC,D.CONFIG_VALUE FROM BAS_REFERENCE_DATA_MASTER M,BAS_REFERENCE_DATA_DETAILS D where M.CONFIG_TYPE=D.CONFIG_TYPE(+) and M.CONFIG_TYPE=\'B2B_VNDR\' and D.CONFIG_KEY=\'NEW_VNDR\'");
                SelectCommand = "SELECT M.CONFIG_TYPE,D.CONFIG_CHINESE_DESC,D.CONFIG_ENGLISH_DESC,D.CONFIG_VALUE FROM BAS_REFERENCE_DATA_MASTER M,BAS_REFERENCE_DATA_DETAILS D where M.CONFIG_TYPE=D.CONFIG_TYPE(+) and M.CONFIG_TYPE=\'B2B_VNDR\' and D.CONFIG_KEY=\'NEW_VNDR\'";
                //Ken : 2.設定動態參數物件
               
                // 計算資料總筆數
                //DataSet dsCount = dba.runExecuteQuery("Vendor_Count", SqlCommandCount + strCondition);
                //Ken : 3.修改執行方法Overload
                ds = DataBase.Query_CLASS(SelectCommand, "BAS_REFERENCE_DATA_MASTER");
                //ds = dba.runExecuteQuery("BAS_REFERENCE_DATA_MASTER", SelectCommand);


                
				if (!(ds == null) && ds.Tables["info"].Rows[0]["ReturnCode"] != "100" && ds.Tables["info"].Rows[0]["ReturnCode"] != "999")
				{
					for (Row = 0; Row <= ds.Tables["BAS_REFERENCE_DATA_MASTER"].Rows.Count - 1; Row++)
					{
						BODY = System.Convert.ToString(ds.Tables["BAS_REFERENCE_DATA_MASTER"].Rows[Row]["CONFIG_CHINESE_DESC"].ToString().Replace("XXXX", " " + txtVENDOR_NO.Text + "-" + VENDOR_NAME + " "));
						//Modify By EmilyLi On 2008/08/19 - 廠商名稱多串廠商代號
						//Subject = ds.Tables("BAS_REFERENCE_DATA_MASTER").Rows(Row)("CONFIG_VALUE").ToString().Replace("XXXX", " " + VENDOR_NAME + " ")
						Subject = System.Convert.ToString(ds.Tables["BAS_REFERENCE_DATA_MASTER"].Rows[Row]["CONFIG_VALUE"].ToString().Replace("XXXX", " " + txtVENDOR_NO.Text + "-" + VENDOR_NAME + " "));
					}
					
				}
				FunctionHandler.SentMail(Subject, MailTo, "", "", "EVAAIR Procurement Information <B2B@evaair.com>", BODY);
				// FunctionHandler.SentMail(Subject, "BEN14784@GMAIL.COM", "", "", "EVAAIR Procurement Information <B2B@evaair.com>", BODY)
				
				//請注意，目前系統有廠商XXXX公司修改報價資料，相關負責人請儘速前往審視相關資料。
				
			}
			catch (Exception ex)
			{
				
				showException(ex.Message);
			}
			finally
			{
			}
		}
		
		private void updBASD010(string user)
		{
			// 設定傳送的 DataSet 物件
			com.ddsc.common.ddscDataSet ddscDs = new com.ddsc.common.ddscDataSet();
			com.ddsc.common.ddscDataTable ddscDt = ddscDs.createDataTable("VND_B2B_VENDOR");
			string SystemDate = DateTime.Now.ToString("yyyyMMdd");
			string SystemTime = DateTime.Now.ToString("HHmmss");
			FunctionHandler FunctionHandler = new FunctionHandler();
			VENDOR LoginUser = GetLoginUser();
			// 宣告回傳DataSet
			DataSet dsResult = new DataSet();
			try
			{
				// 新增Row至ddscDt
				ddscDt.addNewRow();
				// 設定dscDt各欄位Value，參數一：columnName,參數二：columnValue
				ddscDt.setColumnValue("action", "string", "upd");
				ddscDt.setColumnValue("VENDOR_TYPE", "string", rdoVENDOR_TYPE.SelectedValue);
				//ddscDt.setColumnValue("CONSIGNED_FLAG", "string", rdoCONSIGNED_FLAG.SelectedValue)
				ddscDt.setColumnValue("VENDOR_NO", "string", this.txtVENDOR_NO.Text);
				ddscDt.setColumnValue("PROFILE_PRODUCT", "string", txtPROFILE_PRODUCT.Text.Trim());
				ddscDt.setColumnValue("VENDOR_NAME_CHINESE", "string", txtVENDOR_CHINESENAME.Text.Trim());
				ddscDt.setColumnValue("VENDOR_NAME_ENGLISH", "string", txtVENDOR_ENGLISHNAME.Text.Trim());
				ddscDt.setColumnValue("COUNTRY", "string", this.drpCOUNTRY.SelectedValue);
				ddscDt.setColumnValue("CURRENCY_TYPE", "string", this.drpCURRENCY_TYPE.SelectedValue.Trim());
				ddscDt.setColumnValue("AREA_CODE", "string", txtAREA_CODE.Text.Trim());
				ddscDt.setColumnValue("ADDRESS", "string", txtADDRESS.Text.Trim());
				ddscDt.setColumnValue("INVOICE_COUNTRY", "string", this.drpINVOICE_COUNTRY.SelectedValue.Trim());
				ddscDt.setColumnValue("INVOICE_CITY", "string", txtINVOICE_CITY.Text.Trim());
				ddscDt.setColumnValue("INVOICE_STATE", "string", txtINVOICE_STATE.Text.Trim());
				ddscDt.setColumnValue("INVOICE_ADDRESS", "string", txtINVOICE_ADDRESS.Text.Trim());
				ddscDt.setColumnValue("AGENT", "string", txtAGENT.Text.Trim());
				ddscDt.setColumnValue("AGENT_ADDRESS", "string", txtAGENT_ADDRESS.Text.Trim());
				ddscDt.setColumnValue("CLERK", "string", txtCLERK.Text.Trim());
				ddscDt.setColumnValue("CLERK_ADDRESS", "string", txtCLERK_ADDRESS.Text.Trim());
				ddscDt.setColumnValue("MAIL_ADDRESS", "string", txtMAIL_ADDRESS.Text.Trim());
				//Dim DELIVERY_TERM As String
				//If drpDELIVERY_TERM.SelectedValue = "FOB_Seaport" Then
				//    DELIVERY_TERM = drpDELIVERY_TERM.SelectedValue & Me.txtSEAPORT.Text
				//Else
				//    DELIVERY_TERM = drpDELIVERY_TERM.SelectedValue
				//End If
				//  ddscDt.setColumnValue("DELIVERY_TERM", "string", DELIVERY_TERM)
				//ddscDt.setColumnValue("DELIVERY_TERM", "string", drpDELIVERY_TERM.SelectedValue.Trim())
				//ddscDt.setColumnValue("PAYMENT_TERM_NO", "string", Me.drpPAYMENT_TERM_NO.SelectedValue.Trim())
				ddscDt.setColumnValue("VENDOR_KIND", "string", this.drpVENDOR_KIND.SelectedValue.Trim());
				ddscDt.setColumnValue("tel1", "string", txtTEL1.Text.Trim());
				ddscDt.setColumnValue("tel2", "string", txtTEL2.Text.Trim());
				ddscDt.setColumnValue("fax1", "string", txtFAX1.Text.Trim());
				ddscDt.setColumnValue("fax2", "string", txtFAX2.Text.Trim());
				ddscDt.setColumnValue("e_mail1", "string", txtE_MAIL1.Text.Trim());
				ddscDt.setColumnValue("e_mail2", "string", txtE_MAIL2.Text.Trim());
				ddscDt.setColumnValue("e_mail3", "string", txtE_MAIL3.Text.Trim());
				ddscDt.setColumnValue("WEBSITE", "string", txtWEBSITE.Text.Trim());
				ddscDt.setColumnValue("AUTHENTICATION", "string", txtAUTHENTICATION.Text.Trim());
				ddscDt.setColumnValue("COOPERATION", "string", txtCOOPERATION.Text.Trim());
				if (int.Parse(LoginUser.B2B_STATUS) >= 1 || int.Parse(LoginUser.B2B_STATUS) == 0)
				{
					if (this.rdoVENDOR_TYPE.SelectedValue == "D")
					{
						//BENEFICIARYS_AC_NO
						ddscDt.setColumnValue("BANK_NAME", "string", txtBANK_NAME.Text.Trim());
						ddscDt.setColumnValue("BENEFICIARY_NAME", "string", this.txtBENEFICIARY_NAME.Text.Trim());
						ddscDt.setColumnValue("BANK_ADDRESS", "string", txtBANK_ADDRESS.Text.Trim());
						ddscDt.setColumnValue("CURRENCY_1", "string", this.drpCURRENCY_1.SelectedValue.Trim());
						ddscDt.setColumnValue("CURRENCY_2", "string", this.drpCURRENCY_2.SelectedValue.Trim());
						ddscDt.setColumnValue("CURRENCY_3", "string", this.drpCURRENCY_3.SelectedValue.Trim());
						ddscDt.setColumnValue("AC_NO_1", "string", txtAC_NO_1.Text.Trim());
						ddscDt.setColumnValue("AC_NO_2", "string", txtAC_NO_2.Text.Trim());
						ddscDt.setColumnValue("AC_NO_3", "string", txtAC_NO_3.Text.Trim());
						if (LoginUser.B2B_FLAG_STATUS == "2")
						{
							ddscDt.setColumnValue("flag_status", "string", "3");
						}
						
					}
					else
					{
						//BENEFICIARYS_AC_NO
						ddscDt.setColumnValue("BANK_NAME", "string", txtBANK_NAME.Text.Trim());
						ddscDt.setColumnValue("BENEFICIARY_NAME", "string", this.txtBENEFICIARY_NAME.Text.Trim());
						ddscDt.setColumnValue("BANK_ADDRESS", "string", txtBANK_ADDRESS.Text.Trim());
						ddscDt.setColumnValue("CURRENCY_1", "string", this.drpCURRENCY_1.SelectedValue.Trim());
						ddscDt.setColumnValue("CURRENCY_2", "string", this.drpCURRENCY_2.SelectedValue.Trim());
						ddscDt.setColumnValue("CURRENCY_3", "string", this.drpCURRENCY_3.SelectedValue.Trim());
						ddscDt.setColumnValue("AC_NO_1", "string", txtAC_NO_1.Text.Trim());
						ddscDt.setColumnValue("AC_NO_2", "string", txtAC_NO_2.Text.Trim());
						ddscDt.setColumnValue("AC_NO_3", "string", txtAC_NO_3.Text.Trim());
						//BANK_CODE_DETAILS
						ddscDt.setColumnValue("ABA_NO", "string", txtABA_NO.Text.Trim());
						ddscDt.setColumnValue("SORT_CODE", "string", txtSORT_CODE.Text.Trim());
						ddscDt.setColumnValue("CHIPS", "string", txtCHIPS.Text.Trim());
						ddscDt.setColumnValue("IACH", "string", txtIACH.Text.Trim());
						ddscDt.setColumnValue("FEDWIRE_NO", "string", txtFEDWIRD_NO.Text.Trim());
						ddscDt.setColumnValue("LOCAL_CLEARING_BANK_CODE", "string", this.txtLOCAL_CLEARING_BANK_CODE.Text.Trim());
						ddscDt.setColumnValue("ACH", "string", txtACH.Text.Trim());
						ddscDt.setColumnValue("OTHERS", "string", this.txtOTHERS.Text.Trim());
						ddscDt.setColumnValue("SWIFT_CODE", "string", txtSWIFT_CODE.Text.Trim());
						ddscDt.setColumnValue("INTERMEDIARY_BANK_NAME", "string", txtINTERMEDIARY_BANK_NAME.Text.Trim());
						ddscDt.setColumnValue("INTERMEDIARY_BANK_ADDRESS", "string", txtINTERMEDIARY_BANK_ADDRESS.Text.Trim());
						ddscDt.setColumnValue("INTERMEDIARY_BANK_SWIFT_CODE", "string", txtINTERMEDIARY_BANK_SWIFT_CODE.Text.Trim());
						if (LoginUser.B2B_FLAG_STATUS == "2")
						{
							ddscDt.setColumnValue("flag_status", "string", "3");
						}
					}
				}
				
				if (int.Parse(LoginUser.B2B_STATUS) == 0)
				{
					ddscDt.setColumnValue("STATUS", "string", "9");
					ddscDt.setColumnValue("FLAG_STATUS", "string", "9");
				}
				ddscDt.setColumnValue("upd_id", "string", LoginUser.VENDOR_NO);
				ddscDt.setColumnValue("upd_date", "string", SystemDate);
				ddscDt.setColumnValue("upd_time", "string", SystemTime);
				ddscDt.setWhereValue("VENDOR_NO", txtVENDOR_NO.Text);
				com.ddsc.common.ddscDataTable ddscDtp = ddscDs.createDataTable("VND_VENDOR_AUTHORITY");
				if (this.txtVND_PASSWORD.Text != "")
				{
					string PASSWORD = FunctionHandler.Encrypt(this.txtVND_PASSWORD.Text);
					ddscDtp.addNewRow();
					ddscDtp.setColumnValue("action", "string", "upd");
					ddscDtp.setColumnValue("VENDOR_NO", "string", LoginUser.VENDOR_NO);
					ddscDtp.setColumnValue("VENDOR_PWD", "string", PASSWORD);
					ddscDtp.setColumnValue("status", "string", "1");
					ddscDtp.setColumnValue("UPD_id", "string", LoginUser.VENDOR_NO);
					ddscDtp.setColumnValue("UPD_date", "string", SystemDate);
					ddscDtp.setColumnValue("UPD_time", "string", SystemTime);
					ddscDtp.setWhereValue("VENDOR_NO", LoginUser.VENDOR_NO);
				}
				ddscDs.addDataTable(ddscDtp);
				ddscDs.addDataTable(ddscDt);
				// 執行編輯method
				DataBase DataBase = new DataBase();
				dsResult = DataBase.Addition(ddscDs, "", (System.Array) null, (System.Array) null);
				// 寫入script至client端
				regScript_Vendor_maintain(dsResult, "upd", "", LoginUser.B2B_FLAG_STATUS);
				string MailTo = "";
				string SelectCommand = string.Format("select APPLICANT,b.EMAIL from  VND_RELATED_USER A,psn_open_data B WHERE VENDOR_KIND=\'{0}\' and a.APPLICANT=b.EMPLOYEE_NO(+)", this.drpVENDOR_KIND.SelectedValue.Trim());
                dbAccess dba = new dbAccess();
                DataSet ds = default(DataSet);
				ds = DataBase.Query_CLASS(SelectCommand, "VND_RELATED_USER");
                //ds = dba.runExecuteQuery("VND_RELATED_USER", SelectCommand);
				int Row = 0;
				if (!(ds == null) && ds.Tables["info"].Rows[0]["ReturnCode"] != "100" && ds.Tables["info"].Rows[0]["ReturnCode"] != "999")
				{
					for (Row = 0; Row <= ds.Tables["VND_RELATED_USER"].Rows.Count - 1; Row++)
					{
						//MailTo = MailTo + ds.Tables["VND_RELATED_USER"].Rows[Row]["EMAIL"].ToString();


                        //fix mail from AD by employeeid
                        string empID = ds.Tables["VND_RELATED_USER"].Rows[Row]["APPLICANT"].ToString();

                        MailTo = MailTo + (new FunctionHandler()).QueryADInfo(empID, ADQueryType.Email) + ";";
					}
					
				}
				
				if (LoginUser.B2B_FLAG_STATUS == "2")
				{
					string BODY = "";
					string Subject = "";
					
					SelectCommand = string.Format("SELECT M.CONFIG_TYPE,D.CONFIG_CHINESE_DESC,D.CONFIG_ENGLISH_DESC,D.CONFIG_VALUE FROM BAS_REFERENCE_DATA_MASTER M,BAS_REFERENCE_DATA_DETAILS D where M.CONFIG_TYPE=D.CONFIG_TYPE(+) and M.CONFIG_TYPE=\'B2B_VNDR\' and D.CONFIG_KEY=\'VNDR_3\'");
					ds = DataBase.Query_CLASS(SelectCommand, "BAS_REFERENCE_DATA_MASTER");
                    //ds = dba.runExecuteQuery("BAS_REFERENCE_DATA_MASTER", SelectCommand);
                    if (!(ds == null) && ds.Tables["info"].Rows[0]["ReturnCode"] != "100" && ds.Tables["info"].Rows[0]["ReturnCode"] != "999")
					{
						for (Row = 0; Row <= ds.Tables["BAS_REFERENCE_DATA_MASTER"].Rows.Count - 1; Row++)
						{
							BODY = System.Convert.ToString(ds.Tables["BAS_REFERENCE_DATA_MASTER"].Rows[Row]["CONFIG_CHINESE_DESC"].ToString().Replace("XXXX", " " + LoginUser.VENDOR_NO + "-" + LoginUser.ENGLISH_NAME + " "));
							//Modify By EmilyLi On 2008/08/19 - 廠商名稱多串廠商代號
							//Subject = ds.Tables("BAS_REFERENCE_DATA_MASTER").Rows(Row)("CONFIG_VALUE").ToString().Replace("XXXX", " " + LoginUser.ENGLISH_NAME + " ")
							Subject = System.Convert.ToString(ds.Tables["BAS_REFERENCE_DATA_MASTER"].Rows[Row]["CONFIG_VALUE"].ToString().Replace("XXXX", " " + LoginUser.VENDOR_NO + "-" + LoginUser.ENGLISH_NAME + " "));
						}
						
					}
					
					FunctionHandler.SentMail(Subject, MailTo, "", "", "長榮航空採購資訊網 <B2B@evaair.com>", BODY);
					//FunctionHandler.SentMail(Subject, "BEN14784@GMAIL.COM", "", "", "EVAAIR Procurement Information <B2B@evaair.com>", BODY)
					
				}
				
				
				
			}
			catch (Exception ex)
			{
				showException(ex.Message);
			}
			finally
			{
			}
		}
		
		public void regScript_Vendor_maintain(DataSet ds, string action, string msg = "", string B2B_status = "")
		{
			string strResult = System.Convert.ToString(ds.Tables[0].Rows[0]["TransResult"].ToString());
			string strMessage = System.Convert.ToString(ds.Tables[0].Rows[0]["Message"].ToString());
			string strSuccess = "";
			string strFail = "";
			string strClose = "";
			try
			{
				
				if (Session["langauage"] == "zh-tw")
				{
					strSuccess = " 存檔成功 !";
					strFail = "存檔失敗!\\n";
				}
				else
				{
					strSuccess = " SAVE SUCCESS !";
					strFail = "SAVE FAIL !\\n";
				}
				
				
				if (strResult == "T")
				{
					if (!this.IsStartupScriptRegistered("Result"))
					{
						// Me.RegisterStartupScript("Result", "<script language=""javascript""> alert('" & msg & strSuccess & "');" & strClose & " </script>")
						//If B2B_status = "0" Then
						//    showDownFile(strSuccess, "/smasb2b/FILE/downfile.zip")
						//    Me.RegisterStartupScript("Result", "<script language=""javascript""> alert('" & msg & strSuccess & "');window.navigate(""../default.aspx"")" & strClose & " </script>")
						//Else
						//End If
						this.RegisterStartupScript("Result", "<script language=\"javascript\"> alert(\'" + msg + strSuccess + "\');window.navigate(\"../default.aspx\")" + strClose + " </script>");
						
					}
				}
				else if (strResult == "")
				{
					if (!this.IsStartupScriptRegistered("Result"))
					{
						this.RegisterStartupScript("Result", "<script language=\"javascript\">window.returnValue = false;</script>");
					}
				}
				else if (strResult == "F")
				{
					if (!this.IsStartupScriptRegistered("Result"))
					{
						this.RegisterStartupScript("Result", "<script language=\"javascript\"> alert(\'" + msg + strFail + strMessage + "\');window.returnValue = false; </script>");
					}
				}
			}
			catch (Exception ex)
			{
				showException(ex.Message);
			}
			finally
			{
			}
		}
		
		private void btnSave_Click(System.Object sender, System.EventArgs e)
		{
			
			
			string action_type = this.Request["action_type"].ToString();
			if (action_type == "ADD")
			{
				addBASD010(null);
			}
			else
			{
				updBASD010(null);
			}
			
			
		}
		
	}
	
}
